Package com.corundumstudio.socketio.parser

Examples of com.corundumstudio.socketio.parser.Packet


    public SocketAddress getRemoteAddress() {
        return channel.remoteAddress();
    }

    public void disconnect() {
        ChannelFuture future = send(new Packet(PacketType.DISCONNECT));
        future.addListener(ChannelFutureListener.CLOSE);

        onChannelDisconnect();
    }
View Full Code Here


        return new IterableCollection<SocketIOClient>(clients);
    }

    @Override
    public void sendMessage(String message) {
        Packet packet = new Packet(PacketType.MESSAGE);
        packet.setData(message);
        send(packet);
    }
View Full Code Here

        ackCallback.loopFinished();
    }

    @Override
    public void sendJsonObject(Object object) {
        Packet packet = new Packet(PacketType.JSON);
        packet.setData(object);
        send(packet);
    }
View Full Code Here

        }
    }

    @Override
    public void sendEvent(String name, Object... data) {
        Packet packet = new Packet(PacketType.EVENT);
        packet.setName(name);
        packet.setArgs(Arrays.asList(data));
        send(packet);
    }
View Full Code Here

    public void connect(MainBaseClient client) {
        connect(client.getSessionId());
        configuration.getStoreFactory().pubSubStore().publish(PubSubStore.CONNECT, new ConnectMessage(client.getSessionId()));

        client.send(new Packet(PacketType.CONNECT));

        Namespace ns = namespacesHub.get(Namespace.DEFAULT_NAME);
        SocketIOClient nsClient = client.addChildClient(ns);
        namespacesHub.get(ns.getName()).onConnect(nsClient);
    }
View Full Code Here

        if (log.isTraceEnabled()) {
            log.trace("In message: {} sessionId: {}", content.toString(CharsetUtil.UTF_8), client.getSessionId());
        }
        while (content.isReadable()) {
            try {
                Packet packet = decoder.decodePackets(content, client.getSessionId());
                Namespace ns = namespacesHub.get(packet.getEndpoint());
                if (ns == null) {
                    log.debug("Can't find namespace for endpoint: {}, sessionId: {} probably it was removed.", packet.getEndpoint(), client.getSessionId());
                    return;
                }

                if (packet.getType() == PacketType.CONNECT) {
                    client.addChildClient(ns);
                }

                NamespaceClient nClient = (NamespaceClient) client.getChildClient(ns);
                if (nClient == null) {
View Full Code Here

    public void connect(MainBaseClient client) {
        connect(client.getSessionId());
        configuration.getStoreFactory().getPubSubStore().publish(PubSubStore.CONNECT, new ConnectMessage(client.getSessionId()));

        client.send(new Packet(PacketType.CONNECT));

        Namespace ns = namespacesHub.get(Namespace.DEFAULT_NAME);
        SocketIOClient nsClient = client.getChildClient(ns);
        namespacesHub.get(ns.getName()).onConnect(nsClient);
    }
View Full Code Here

        scheduler.schedule(key, new Runnable() {
            @Override
            public void run() {
                XHRPollingClient client = sessionId2Client.get(sessionId);
                if (client != null) {
                    client.send(new Packet(PacketType.NOOP));
                }
            }
        }, configuration.getPollingDuration(), TimeUnit.SECONDS);
    }
View Full Code Here

        return client;
    }

    private void sendError(Channel channel, String origin, UUID sessionId) {
        log.debug("Client with sessionId: {} was not found! Reconnect error response sended", sessionId);
        Packet packet = new Packet(PacketType.ERROR);
        packet.setReason(ErrorReason.CLIENT_NOT_HANDSHAKEN);
        packet.setAdvice(ErrorAdvice.RECONNECT);
        channel.write(new XHRErrorMessage(packet, origin));
    }
View Full Code Here

    public SocketAddress getRemoteAddress() {
        return channel.getRemoteAddress();
    }

    public void disconnect() {
        ChannelFuture future = send(new Packet(PacketType.DISCONNECT));
        future.addListener(ChannelFutureListener.CLOSE);

        onChannelDisconnect();
    }
View Full Code Here

TOP

Related Classes of com.corundumstudio.socketio.parser.Packet

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.