Package org.eclipse.jetty.websocket.api

Examples of org.eclipse.jetty.websocket.api.RemoteEndpoint


            // wait for connect
            Session session = fut.get(5,TimeUnit.SECONDS);

            // Generate text frame
            RemoteEndpoint remote = session.getRemote();
            remote.sendString("session.upgradeRequest.requestURI");
            if (remote.getBatchMode() == BatchMode.ON)
                remote.flush();

            // Read frame (hopefully text frame)
            clientSocket.messages.awaitEventCount(1,500,TimeUnit.MILLISECONDS);
            EventQueue<String> captured = clientSocket.messages;
            String expected = String.format("session.upgradeRequest.requestURI=%s",requestUri.toASCIIString());
View Full Code Here


    @Override
    public void onWebSocketBinary(byte[] payload, int offset, int len)
    {
        try
        {
            RemoteEndpoint remote = getRemote();
            remote.sendBytes(BufferUtil.toBuffer(payload, offset, len), null);
            if (remote.getBatchMode() == BatchMode.ON)
                remote.flush();
        }
        catch (IOException x)
        {
            throw new RuntimeIOException(x);
        }
View Full Code Here

    @Override
    public void onWebSocketText(String message)
    {
        try
        {
            RemoteEndpoint remote = getRemote();
            remote.sendString(message, null);
            if (remote.getBatchMode() == BatchMode.ON)
                remote.flush();
        }
        catch (IOException x)
        {
            throw new RuntimeIOException(x);
        }
View Full Code Here

    {
        LOG.debug("onBinary(byte[{}],{},{})",buf.length,offset,len);

        // echo the message back.
        ByteBuffer data = ByteBuffer.wrap(buf,offset,len);
        RemoteEndpoint remote = session.getRemote();
        remote.sendBytes(data, null);
        if (remote.getBatchMode() == BatchMode.ON)
            remote.flush();
    }
View Full Code Here

        {
            throw new RuntimeException("Something bad happened");
        }

        // echo the message back.
        RemoteEndpoint remote = session.getRemote();
        remote.sendString(message, null);
        if (remote.getBatchMode() == BatchMode.ON)
            remote.flush();
    }
View Full Code Here

    public void sendMessage(String msg) throws IOException
    {
        remoteLock.lock();
        try
        {
            RemoteEndpoint r = remote;
            if (r == null)
            {
                return;
            }

            r.sendStringByFuture(msg);
            if (r.getBatchMode() == BatchMode.ON)
                r.flush();
        }
        finally
        {
            remoteLock.unlock();
        }
View Full Code Here

        }
    }

    protected void sendString(String text) throws IOException
    {
        RemoteEndpoint remote = session.getRemote();
        remote.sendString(text, null);
        if (remote.getBatchMode() == BatchMode.ON)
            remote.flush();
    }
View Full Code Here

    {
        LOG.debug("onBinary(byte[{}],{},{})",buf.length,offset,len);

        // echo the message back.
        ByteBuffer data = ByteBuffer.wrap(buf,offset,len);
        RemoteEndpoint remote = this.session.getRemote();
        remote.sendBytes(data, null);
        if (remote.getBatchMode() == BatchMode.ON)
            remote.flush();
    }
View Full Code Here

    public void onText(String message) throws IOException
    {
        LOG.debug("onText({})",message);

        // echo the message back.
        RemoteEndpoint remote = session.getRemote();
        remote.sendString(message, null);
        if (remote.getBatchMode() == BatchMode.ON)
            remote.flush();
    }
View Full Code Here

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("[{}] Message received from browser: {}", mySession.hashCode(), aMessage);
        }

        try {
            RemoteEndpoint remote = mySession.getRemote();

            if (aMessage.contains(":")) {
                String[] instructions = aMessage.split(":");

                if (instructions[0].equals("log") && instructions.length > 1) {
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.websocket.api.RemoteEndpoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.