Closed jodyhuang closed 7 years ago
Hey, I think you are using pub-sub without creating channels. I think you should create a channel, subscribe to it and then use listener for incoming data. I have replied to your existing issue on github. It's better if you can create a new issue for this query on official client.For creating channels and using them, read official documentation available on github repo. In current scenario, you are trying to apply listener event without actually subscribing to channel. Btw, you cannot create channels on server side. It's just an abstract concept created on client side to understand Pub-Sub. There might be methods for using pub-sub on server side.You can refer to doc available on http://socketcluster.io/#!/.
Excuse me, I have an issue about SC Android client, When nodejs server publish message by scServer.exchange.publish(’S12’, data) In Android client, I subscribe the channel ’S12’ as following: 1 scSocket.onSubscribe("S12_2",new Emitter.Listener() { 2 @Override 3 public void call(String name, final Object data) { 4 Log.e("# onSubscribe #", "Listen onSubscribe"); 5 } 6 }); But I can’t receive the message, the onSubscribe doesn’t be fired at all, following source code doesn’t fired too.
scSocket.on("S12_2", new Emitter.Listener() { public void call(String eventName, Object object) { JSONObject data; try { data = new JSONObject((String) object); Log.e("# Receive #", (String)object); //channel = data.getString("session"); } catch (JSONException e) { return; } } });
Can you help me, thank you so much!