Tyrus Websockets: RSV bit(s) incorrectly set

337 views Asked by At

I'm trying to set up a websocket server in java using tyrus, connecting to it via a website opened in firefox. I'm using localhost for the ip address. The connection is established fine, but as soon as I try to send a message accross the server immediately disconnects with the following reason:

1002,RSV bit(s) incorrectly set.

I haven't overriden any default settings, just set up server and connect to it. I'll post some code in case it's relevant:

java server

Server server = new Server("localhost", 8000, "/", null, BridgeEndpoint.class);
server.start();

...

@ServerEndpoint(value="/producer")
public class BridgeEndpoint {

    ...

    @OnMessage
    public void onMessage(Session session, Message message) {
        System.out.println("message");
        message.setFrom(users.get(session.getId()));
        broadcast(message);
    }

    @OnClose
    public void onClose(Session session, CloseReason reason)  {
        chatEndpoints.remove(this);
        Message message = new Message();
        message.setFrom(users.get(session.getId()));
        message.setContent("Disconnected! " + reason);
        broadcast(message);
        System.out.println("Disconnected! " + reason);
    }

    ...

}

javascript client

let socket = new WebSocket("ws://localhost:8000/producer");
socket.send("Hello world!");
0

There are 0 answers