Package io.netty.handler.codec.stomp

Examples of io.netty.handler.codec.stomp.DefaultStompFrame.headers()


    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        state = ClientState.AUTHENTICATING;
        StompFrame connFrame = new DefaultStompFrame(StompCommand.CONNECT);
        connFrame.headers().set(StompHeaders.ACCEPT_VERSION, "1.2");
        connFrame.headers().set(StompHeaders.HOST, StompClient.HOST);
        connFrame.headers().set(StompHeaders.LOGIN, StompClient.LOGIN);
        connFrame.headers().set(StompHeaders.PASSCODE, StompClient.PASSCODE);
        ctx.writeAndFlush(connFrame);
    }
View Full Code Here


    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        state = ClientState.AUTHENTICATING;
        StompFrame connFrame = new DefaultStompFrame(StompCommand.CONNECT);
        connFrame.headers().set(StompHeaders.ACCEPT_VERSION, "1.2");
        connFrame.headers().set(StompHeaders.HOST, StompClient.HOST);
        connFrame.headers().set(StompHeaders.LOGIN, StompClient.LOGIN);
        connFrame.headers().set(StompHeaders.PASSCODE, StompClient.PASSCODE);
        ctx.writeAndFlush(connFrame);
    }
View Full Code Here

    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        state = ClientState.AUTHENTICATING;
        StompFrame connFrame = new DefaultStompFrame(StompCommand.CONNECT);
        connFrame.headers().set(StompHeaders.ACCEPT_VERSION, "1.2");
        connFrame.headers().set(StompHeaders.HOST, StompClient.HOST);
        connFrame.headers().set(StompHeaders.LOGIN, StompClient.LOGIN);
        connFrame.headers().set(StompHeaders.PASSCODE, StompClient.PASSCODE);
        ctx.writeAndFlush(connFrame);
    }

    @Override
View Full Code Here

        state = ClientState.AUTHENTICATING;
        StompFrame connFrame = new DefaultStompFrame(StompCommand.CONNECT);
        connFrame.headers().set(StompHeaders.ACCEPT_VERSION, "1.2");
        connFrame.headers().set(StompHeaders.HOST, StompClient.HOST);
        connFrame.headers().set(StompHeaders.LOGIN, StompClient.LOGIN);
        connFrame.headers().set(StompHeaders.PASSCODE, StompClient.PASSCODE);
        ctx.writeAndFlush(connFrame);
    }

    @Override
    protected void messageReceived(ChannelHandlerContext ctx, StompFrame frame) throws Exception {
View Full Code Here

        String subscrReceiptId = "001";
        String disconReceiptId = "002";
        switch (frame.command()) {
            case CONNECTED:
                StompFrame subscribeFrame = new DefaultStompFrame(StompCommand.SUBSCRIBE);
                subscribeFrame.headers().set(StompHeaders.DESTINATION, StompClient.TOPIC);
                subscribeFrame.headers().set(StompHeaders.RECEIPT, subscrReceiptId);
                subscribeFrame.headers().set(StompHeaders.ID, "1");
                System.out.println("connected, sending subscribe frame: " + subscribeFrame);
                state = ClientState.AUTHENTICATED;
                ctx.writeAndFlush(subscribeFrame);
View Full Code Here

        String disconReceiptId = "002";
        switch (frame.command()) {
            case CONNECTED:
                StompFrame subscribeFrame = new DefaultStompFrame(StompCommand.SUBSCRIBE);
                subscribeFrame.headers().set(StompHeaders.DESTINATION, StompClient.TOPIC);
                subscribeFrame.headers().set(StompHeaders.RECEIPT, subscrReceiptId);
                subscribeFrame.headers().set(StompHeaders.ID, "1");
                System.out.println("connected, sending subscribe frame: " + subscribeFrame);
                state = ClientState.AUTHENTICATED;
                ctx.writeAndFlush(subscribeFrame);
                break;
View Full Code Here

        switch (frame.command()) {
            case CONNECTED:
                StompFrame subscribeFrame = new DefaultStompFrame(StompCommand.SUBSCRIBE);
                subscribeFrame.headers().set(StompHeaders.DESTINATION, StompClient.TOPIC);
                subscribeFrame.headers().set(StompHeaders.RECEIPT, subscrReceiptId);
                subscribeFrame.headers().set(StompHeaders.ID, "1");
                System.out.println("connected, sending subscribe frame: " + subscribeFrame);
                state = ClientState.AUTHENTICATED;
                ctx.writeAndFlush(subscribeFrame);
                break;
            case RECEIPT:
View Full Code Here

                break;
            case RECEIPT:
                String receiptHeader = frame.headers().get(StompHeaders.RECEIPT_ID);
                if (state == ClientState.AUTHENTICATED && receiptHeader.equals(subscrReceiptId)) {
                    StompFrame msgFrame = new DefaultStompFrame(StompCommand.SEND);
                    msgFrame.headers().set(StompHeaders.DESTINATION, StompClient.TOPIC);
                    msgFrame.content().writeBytes("some payload".getBytes());
                    System.out.println("subscribed, sending message frame: " + msgFrame);
                    state = ClientState.SUBSCRIBED;
                    ctx.writeAndFlush(msgFrame);
                } else if (state == ClientState.DISCONNECTING && receiptHeader.equals(disconReceiptId)) {
View Full Code Here

                break;
            case MESSAGE:
                if (state == ClientState.SUBSCRIBED) {
                    System.out.println("received frame: " + frame);
                    StompFrame disconnFrame = new DefaultStompFrame(StompCommand.DISCONNECT);
                    disconnFrame.headers().set(StompHeaders.RECEIPT, disconReceiptId);
                    System.out.println("sending disconnect frame: " + disconnFrame);
                    state = ClientState.DISCONNECTING;
                    ctx.writeAndFlush(disconnFrame);
                }
                break;
View Full Code Here

    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        state = ClientState.AUTHENTICATING;
        StompFrame connFrame = new DefaultStompFrame(StompCommand.CONNECT);
        connFrame.headers().set(StompHeaders.ACCEPT_VERSION, "1.2");
        connFrame.headers().set(StompHeaders.HOST, StompClient.HOST);
        connFrame.headers().set(StompHeaders.LOGIN, StompClient.LOGIN);
        connFrame.headers().set(StompHeaders.PASSCODE, StompClient.PASSCODE);
        ctx.writeAndFlush(connFrame);
    }
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.