Pusher pusher = new Pusher(app key);
String socketId = pusher.getConnection().getSocketId();
The socketId
is null when trying to connect to pusher.
The uri the Pusher client is using to make a websocket call is
ws://ws.pusherapp.com:80/app/{app Key}?client=java-client&protocol=5&version=0.3.3
This returns a NULL
socket Id
But, if I make a Websocket connection using a test client using the same URI, I get a valid socketId. What am I doing wrong?
The socketId won't be set until the connection has been established. Please see the onConnectionStateChange interface method here: https://github.com/pusher/pusher-websocket-java#api-overview
Here's the code updated specifically to get the socketId: