这是什么连接? [英] What Connection is this?

查看:136
本文介绍了这是什么连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在学习

So I'm following tutorial of Face detection using HTML5, javascript, webrtc, websockets, Jetty and OpenCV. Not exactly like that, but more or less like that (Like, I don't use the face detection thingy). I use Eclipse to implement it.

有这些部分(我简化了)

There's these parts (I simplified it)

private Connection connection;

public void onOpen(Connection connection) {
        this.connection = connection;
        this.connection.setMaxBinaryMessageSize(1024 * 512);
    }

public void onMessage(byte[] data, int offset, int length) {
    try {
        this.connection.sendMessage(data, 0, data.length);
    } catch (IOException e) { }
}

让我感到困惑的那一行是

and the specific line that's confusing me is

this.connection.sendMessage(result, 0, result.length);

这里使用的Connection是什么?当我使用Eclipse的Ctrl + Shift + O时,Eclipse从我拥有的库中提供了这些

what is the Connection that's being used here? When I use Ctrl+Shift+O of Eclipse, from the lib I had, Eclipse offer these

  1. org.eclipse.jetty.io.Connection
  2. org.eclipse.jetty.client.api.Connection
  3. java.sql.Connection
  1. org.eclipse.jetty.io.Connection
  2. org.eclipse.jetty.client.api.Connection
  3. java.sql.Connection

,但是它给出的Connection都没有该sendMessage方法.我尝试过搜索网络,但是我发现使用同一行的教程也没有说明任何内容.

but none of the Connection it gave have that sendMessage method. I've tried searching the net, but the tutorials I've found that used the same line, also didn't tell anything about it.

那是什么连接?是不是我还没有图书馆呢?

What is that Connection? Is there from any lib I haven't had yet?

还有这个javadoc页面似乎可以解释此类,并且确实具有相同的方法和相同的参数,但是我仍然不明白.似乎Jetty附带了它,但是哪个罐子呢?我还是用了Jetty 9.x ...

And there's this javadoc page of that seems to explain this class, and it does have the same method with same params, but I still don't understand. Seems that it comes with Jetty, but which jar? I used Jetty 9.x though...

非常感谢您.

推荐答案

它可能来自org.eclipse.jetty.websocket.WebSocket包.

It might be from the org.eclipse.jetty.websocket.WebSocket package.

您可以在此处找到JAR: http://mvnrepository.com/artifact/org.eclipse .jetty/jetty-websocket/8.1.0.RC5

You can find the JAR here: http://mvnrepository.com/artifact/org.eclipse.jetty/jetty-websocket/8.1.0.RC5

这篇关于这是什么连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆