crossbario / autobahn-java

WebSocket & WAMP in Java for Android and Java 8
https://crossbar.io/autobahn
MIT License
1.52k stars 427 forks source link

read websocket api json format in Java Desktop App #533

Closed ezizrehimov closed 2 years ago

ezizrehimov commented 2 years ago

How i can read websocket api json format in Java Desktop App? i added your jar file and tryed this, but this not worked. and this is not import. My webscoket api url : ws://168.119.56.105/radioapi/ws

       WebSocketConnection connection = new WebSocketConnection();
        connection.connect("ws://168.119.56.105/radioapi/ws", new WebSocketConnectionHandler() {
            @Override
            public void onConnect(ConnectionResponse response) {
                System.out.println("Connected to server");
            }

            @Override
            public void onOpen() {
                connection.sendMessage("Echo with Autobahn");
            }

            @Override
            public void onClose(int code, String reason) {
                System.out.println("Connection closed");
            }

            @Override
            public void onMessage(String payload) {
                System.out.println("Received message: " + payload);
                connection.sendMessage(payload);
            }
        });