Examples of WebSocketTransport


Examples of com.corundumstudio.socketio.transport.WebSocketTransport

        StoreFactory factory = configuration.getStoreFactory();
        factory.init(namespacesHub, authorizeHandler, jsonSupport);

        xhrPollingTransport = new XHRPollingTransport(connectPath, ackManager, this, scheduler, authorizeHandler, configuration);
        webSocketTransport = new WebSocketTransport(connectPath, isSsl, ackManager, this, authorizeHandler, heartbeatHandler, factory, configuration.getMaxFramePayloadLength());
        flashSocketTransport = new FlashSocketTransport(connectPath, isSsl, ackManager, this, authorizeHandler, heartbeatHandler, factory, configuration.getMaxFramePayloadLength());

        resourceHandler = new ResourceHandler(configuration.getContext());
        encoderHandler = new EncoderHandler(encoder, configuration);
        wrongUrlHandler = new WrongUrlHandler();
View Full Code Here

Examples of com.corundumstudio.socketio.transport.WebSocketTransport

        }

        packetHandler = new PacketHandler(packetListener, decoder, namespacesHub);
        authorizeHandler = new AuthorizeHandler(connectPath, scheduler, configuration, namespacesHub);
        xhrPollingTransport = new XHRPollingTransport(connectPath, ackManager, this, scheduler, authorizeHandler, configuration);
        webSocketTransport = new WebSocketTransport(connectPath, isSsl, ackManager, this, authorizeHandler, heartbeatHandler);
        flashSocketTransport = new FlashSocketTransport(connectPath, isSsl, ackManager, this, authorizeHandler, heartbeatHandler);
        resourceHandler = new ResourceHandler(configuration.getContext());
        socketIOEncoder = new SocketIOEncoder(encoder);
        wrongUrlHandler = new WrongUrlHandler();
    }
View Full Code Here

Examples of org.atmosphere.socketio.transport.WebSocketTransport

        if (suspendWebXML != null) {
            suspendTime = Integer.parseInt(suspendWebXML);
        }

        // VERSION 1
        WebSocketTransport websocketTransport1 = new WebSocketTransport();
        XHRPollingTransport xhrPollingTransport1 = new XHRPollingTransport(BUFFER_SIZE_DEFAULT);
        JSONPPollingTransport jsonpPollingTransport1 = new JSONPPollingTransport(BUFFER_SIZE_DEFAULT);
        transports.put(websocketTransport1.getName() + "-1", websocketTransport1);
        transports.put(xhrPollingTransport1.getName() + "-1", xhrPollingTransport1);
        transports.put(jsonpPollingTransport1.getName() + "-1", jsonpPollingTransport1);

        sessionManager.setTimeout(timeout);
        sessionManager.setHeartbeatInterval(heartbeatInterval);
View Full Code Here

Examples of org.atmosphere.wasync.transport.WebSocketTransport

        return rootFuture.finishOrThrowException();
    }

    public void webSocketWrite(Request request, Object object, Object data) throws IOException {
        WebSocketTransport webSocketTransport = WebSocketTransport.class.cast(transport);
        if (InputStream.class.isAssignableFrom(object.getClass())) {
            InputStream is = (InputStream) object;
            ByteArrayOutputStream bs = new ByteArrayOutputStream();
            //TODO: We need to stream directly, in AHC!
            byte[] buffer = new byte[8192];
            int n = 0;
            while (-1 != (n = is.read(buffer))) {
                bs.write(buffer, 0, n);
            }
            webSocketTransport.sendMessage(bs.toByteArray());
        } else if (Reader.class.isAssignableFrom(object.getClass())) {
            Reader is = (Reader) object;
            StringWriter bs = new StringWriter();
            //TODO: We need to stream directly, in AHC!
            char[] chars = new char[8192];
            int n = 0;
            while (-1 != (n = is.read(chars))) {
                bs.write(chars, 0, n);
            }
            webSocketTransport.sendMessage(bs.getBuffer().toString());
        } else if (String.class.isAssignableFrom(object.getClass())) {
            webSocketTransport.sendMessage(object.toString());
        } else if (byte[].class.isAssignableFrom(object.getClass())) {
            webSocketTransport.sendMessage((byte[]) object);
        } else {
            throw new IllegalStateException("No Encoder for " + data);
        }
    }
View Full Code Here

Examples of org.atmosphere.wasync.transport.WebSocketTransport

    protected List<Transport> getTransport(RequestBuilder r, Request request) throws IOException {
        List<Transport> transports = new ArrayList<Transport>();

        if (request.transport().size() == 0) {
            transports.add(new WebSocketTransport(r, options, request, functions));
            transports.add(new LongPollingTransport(r, options, request, functions));
        }

        for (Request.TRANSPORT t : request.transport()) {
            if (t.equals(Request.TRANSPORT.WEBSOCKET)) {
                transports.add(new WebSocketTransport(r, options, request, functions));
            } else if (t.equals(Request.TRANSPORT.SSE)) {
                transports.add(new SSETransport(r, options, request, functions));
            } else if (t.equals(Request.TRANSPORT.LONG_POLLING)) {
                transports.add(new LongPollingTransport(r, options, request, functions));
            } else if (t.equals(Request.TRANSPORT.STREAMING)) {
View Full Code Here

Examples of org.cometd.websocket.client.WebSocketTransport

    private ClientTransport newWebSocketTransport()
    {
        switch (wsTransportClass)
        {
            case JSR_WS_TRANSPORT:
                return new WebSocketTransport(null, null, wsClientContainer);
            case JETTY_WS_TRANSPORT:
                return new JettyWebSocketTransport(null, null, wsClient);
            default:
                throw new AssertionError();
        }
View Full Code Here

Examples of org.cometd.websocket.client.WebSocketTransport

                options.put(ClientTransport.JSON_CONTEXT_OPTION, new Jackson1JSONContextClient());
                options.put(ClientTransport.MAX_NETWORK_DELAY_OPTION, Config.MAX_NETWORK_DELAY);
                // Differently from HTTP where the idle timeout is adjusted if it is a /meta/connect
                // for WebSocket we need an idle timeout that is longer than the /meta/connect timeout.
                options.put(WebSocketTransport.IDLE_TIMEOUT_OPTION, Config.META_CONNECT_TIMEOUT + httpClient.getIdleTimeout());
                return new WebSocketTransport(options, scheduler, webSocketContainer);
            }
            case JETTY_WEBSOCKET:
            {
                Map<String, Object> options = new HashMap<>();
                options.put(ClientTransport.JSON_CONTEXT_OPTION, new Jackson1JSONContextClient());
View Full Code Here

Examples of org.cometd.websocket.client.WebSocketTransport

    // Transports are set the cookieProvider *after* creating the bayeuxClient, because
    // BayeuxClient invariably sets its own cookieProvider inside the constructor.
    BayeuxClient bayeuxClient;   
    if (builder.webSocketEnabled) {
      WebSocketTransport webSocketTransport = createWebSocketTransport();
      bayeuxClient = new BayeuxClient(builder.client.serverUri + "/api/v2/notifications", webSocketTransport, longPollingTransport);
      webSocketTransport.setCookieProvider(builder.cookieSession.getCookieProvider());
    } else {
      bayeuxClient = new BayeuxClient(builder.client.serverUri + "/api/v2/notifications", longPollingTransport);
    }
    longPollingTransport.setCookieProvider(builder.cookieSession.getCookieProvider());
   
View Full Code Here

Examples of org.cometd.websocket.client.WebSocketTransport

    } catch (Exception e) {
      // Can't happen as WebSocketClientFactory.start() doesn't throw exceptions.
      throw new AssertionError(e);
    }
    ScheduledExecutorService scheduler = null;
    WebSocketTransport webSocketTransport = new WebSocketTransport(webSocketOptions, webSocketClientFactory, scheduler);
    return webSocketTransport;
  }
View Full Code Here

Examples of org.cometd.websocket.server.WebSocketTransport

  public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
    if (bean instanceof BayeuxServerImpl) {
      BayeuxServerImpl bayeux = (BayeuxServerImpl) bean;

      // add the web socket transport
      bayeux.addTransport(new WebSocketTransport(bayeux));
    }

    return bean;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.