org.eclipse.jetty.websocket.WebSocket.OnTextMessage Java Examples

The following examples show how to use org.eclipse.jetty.websocket.WebSocket.OnTextMessage. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebSocketConnectionRFC6455.java    From IoTgo_Android_App with MIT License 5 votes vote down vote up
public WebSocketConnectionRFC6455(WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, int maxIdleTime, String protocol, List<Extension> extensions,int draft, MaskGen maskgen)
    throws IOException
{
    super(endpoint,timestamp);

    _context=Thread.currentThread().getContextClassLoader();

    _endp.setMaxIdleTime(maxIdleTime);

    _webSocket = websocket;
    _onFrame=_webSocket instanceof OnFrame ? (OnFrame)_webSocket : null;
    _onTextMessage=_webSocket instanceof OnTextMessage ? (OnTextMessage)_webSocket : null;
    _onBinaryMessage=_webSocket instanceof OnBinaryMessage ? (OnBinaryMessage)_webSocket : null;
    _onControl=_webSocket instanceof OnControl ? (OnControl)_webSocket : null;
    _generator = new WebSocketGeneratorRFC6455(buffers, _endp,maskgen);

    _extensions=extensions;
    WebSocketParser.FrameHandler frameHandler = new WSFrameHandler();
    if (_extensions!=null)
    {
        int e=0;
        for (Extension extension : _extensions)
        {
            extension.bind(
                    _connection,
                    e==extensions.size()-1? frameHandler :extensions.get(e+1),
                    e==0?_generator:extensions.get(e-1));
            e++;
        }
    }

    _outbound=(_extensions==null||_extensions.size()==0)?_generator:extensions.get(extensions.size()-1);
    WebSocketParser.FrameHandler inbound = (_extensions == null || _extensions.size() == 0) ? frameHandler : extensions.get(0);

    _parser = new WebSocketParserRFC6455(buffers, endpoint, inbound,maskgen==null);

    _protocol=protocol;

}
 
Example #2
Source File: WebSocketConnectionRFC6455.java    From IoTgo_Android_App with MIT License 5 votes vote down vote up
public WebSocketConnectionRFC6455(WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, int maxIdleTime, String protocol, List<Extension> extensions,int draft, MaskGen maskgen)
    throws IOException
{
    super(endpoint,timestamp);

    _context=Thread.currentThread().getContextClassLoader();

    _endp.setMaxIdleTime(maxIdleTime);

    _webSocket = websocket;
    _onFrame=_webSocket instanceof OnFrame ? (OnFrame)_webSocket : null;
    _onTextMessage=_webSocket instanceof OnTextMessage ? (OnTextMessage)_webSocket : null;
    _onBinaryMessage=_webSocket instanceof OnBinaryMessage ? (OnBinaryMessage)_webSocket : null;
    _onControl=_webSocket instanceof OnControl ? (OnControl)_webSocket : null;
    _generator = new WebSocketGeneratorRFC6455(buffers, _endp,maskgen);

    _extensions=extensions;
    WebSocketParser.FrameHandler frameHandler = new WSFrameHandler();
    if (_extensions!=null)
    {
        int e=0;
        for (Extension extension : _extensions)
        {
            extension.bind(
                    _connection,
                    e==extensions.size()-1? frameHandler :extensions.get(e+1),
                    e==0?_generator:extensions.get(e-1));
            e++;
        }
    }

    _outbound=(_extensions==null||_extensions.size()==0)?_generator:extensions.get(extensions.size()-1);
    WebSocketParser.FrameHandler inbound = (_extensions == null || _extensions.size() == 0) ? frameHandler : extensions.get(0);

    _parser = new WebSocketParserRFC6455(buffers, endpoint, inbound,maskgen==null);

    _protocol=protocol;

}
 
Example #3
Source File: WebSocketConnectionRFC6455.java    From WebSocket-for-Android with Apache License 2.0 5 votes vote down vote up
public WebSocketConnectionRFC6455(WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, int maxIdleTime, String protocol, List<Extension> extensions,int draft, MaskGen maskgen)
    throws IOException
{
    super(endpoint,timestamp);

    _context=Thread.currentThread().getContextClassLoader();

    _endp.setMaxIdleTime(maxIdleTime);

    _webSocket = websocket;
    _onFrame=_webSocket instanceof OnFrame ? (OnFrame)_webSocket : null;
    _onTextMessage=_webSocket instanceof OnTextMessage ? (OnTextMessage)_webSocket : null;
    _onBinaryMessage=_webSocket instanceof OnBinaryMessage ? (OnBinaryMessage)_webSocket : null;
    _onControl=_webSocket instanceof OnControl ? (OnControl)_webSocket : null;
    _generator = new WebSocketGeneratorRFC6455(buffers, _endp,maskgen);

    _extensions=extensions;
    WebSocketParser.FrameHandler frameHandler = new WSFrameHandler();
    if (_extensions!=null)
    {
        int e=0;
        for (Extension extension : _extensions)
        {
            extension.bind(
                    _connection,
                    e==extensions.size()-1? frameHandler :extensions.get(e+1),
                    e==0?_generator:extensions.get(e-1));
            e++;
        }
    }

    _outbound=(_extensions==null||_extensions.size()==0)?_generator:extensions.get(extensions.size()-1);
    WebSocketParser.FrameHandler inbound = (_extensions == null || _extensions.size() == 0) ? frameHandler : extensions.get(0);

    _parser = new WebSocketParserRFC6455(buffers, endpoint, inbound,maskgen==null);

    _protocol=protocol;

}