Events are not being listened from android devices
I have done setup of deepstream on my local mac machine. its working fine used js client for creating master to emit event whenever device gets connected to deepstream with listen and its working fine
const DeepstreamClient = require( '../src/client' )
const ds = DeepstreamClient( 'localhost:6021' )
ds.login()
ds.event.listen('57fb28b9ef70ca0d6238df2d/commands', function (eventName, isSubscribed, response) {
console.log('eventName:',eventName, ' , isSubscribed:', isSubscribed, ' ,response:', response)
if (isSubscribed) {
ds.event.emit('57fb28b9ef70ca0d6238df2d/commands', '#Command1')
}
else {
}
})
ds.event.subscribe("57fb28b9ef70ca0d6238df2d/loggedIn", function (deviceId){
console.log("device loggedIn : ", deviceId)
})
And below is what i have used in java to connect with deepstream
try {
dp = new DeepstreamClient("192.168.1.134:6021", new DeepstreamRuntimeErrorHandler() {
@Override
public void onException(Topic topic, Event event, String errorMessage) {
System.out.println("exception : " + errorMessage);
}
});
dp.login();
dp.event.emit("57fb28b9ef70ca0d6238df2d/loggedIn", "oneplus2");
dp.event.subscribe("57fb28b9ef70ca0d6238df2d/commands", new EventListener() {
@Override
public void onEvent(String eventName, Object... args) {
System.out.println("event called : " + eventName);
}
});
} catch (Exception e) {
e.printStackTrace();
}
Its able to connect to deep-stream, as i can see logs coming over deep-stream terminal for Incoming connection But master which is working already is not able to listen to above android incoming device also emitting manual event is not reaching to device.
Whereas, trying same stuff from another terminal window of my mac machine its working fine.
const DeepstreamClient = require( '../src/client' )
const ds = DeepstreamClient( 'localhost:6021' )
ds.login()
ds.event.emit("57fb28b9ef70ca0d6238df2d/loggedIn", "terminal");
ds.event.subscribe("57fb28b9ef70ca0d6238df2d/commands", function (data){
console.log("command received : ", data)
})
console.log("subscribed to 57fb28b9ef70ca0d6238df2d/commands")
Need help on why android device is not able to listen to any event happening from master. Anything i am missing.
hey @amanaman118
The java master is currently using websockets as part of our move from engine.io to uws.
Can you use this version:
https://github.com/deepstreamIO/deepstream.io-client-java/commit/0b6d3043ca4963ff83116c5e14d28d46c8938664
Thnx @yasserf I have downloaded zipped content of commit id (0b6d3043ca4963ff83116c5e14d28d46c8938664) shared by you.
But couldn't find any difference in codebase of above commit id and latest code pulled from java master branch.
As i have compared all code file with latest one. Their is no change in the source code of deepstream to connect back with tcp connectivity.
Ah, sorry I assumed you were connecting via websocket which makes connectivity not work against master deepstream.io server
Can you tell me if https://github.com/deepstreamIO/deepstream.io-client-java/tree/master/src/testapplication/java/io/deepstream/testapp works? That covers all the usual subscribe/publish aspects.
Sorry to say, i am getting exception with what above sample code has. Its with url exception.
java.net.URISyntaxException: URL provided is not correct: ws://192.168.1.134:6020/deepstream
10-12 17:29:42.565 com.aman.ds W/System.err: at io.deepstream.EndpointTCP.
yeah thats the problem due to it using pure websockets rather than TCP, you should use the latest release tag. I do apologise, this is a pretty big transition so relying on master isn't the best approach for the next few days.
Hi, @yasserf I have tried 0.8 tag release as well. But same issue persist when tried from android device. Deepstream terminal is showing incoming connection. Do i need to use any older version of deepstream as well. Because i have used 0.8 tag release of java/android client.
Below is what comming over in my terminal window
INFO | logger ready
INFO | deepstream version: 1.1.1
INFO | configuration file loaded from conf/config.yml
INFO | library directory set to: /Aman/SafariDwn/deepstream.io-mac-1.1.1/lib
INFO | messageConnector ready
INFO | storage ready
INFO | cache ready
INFO | authenticationHandler ready: none
INFO | permissionHandler ready: valve permissions loaded from /Aman/SafariDwn/deepstream.io-mac-1.1.1/conf/permissions.yml
INFO | Using uws websocket server
CLUSTER_JOIN | iu7ax5gd-1wlevc7gn9a84
INFO | Listening for tcp connections on 0.0.0.0:6021
INFO | Listening for browser connections on 0.0.0.0:6020
INFO | Deepstream started
CLUSTER_LEAVE | iu7ax5gd-1wlevc7gn9a84
CLUSTER_JOIN | iu7ax5gd-1wlevc7gn9a84
INCOMING_CONNECTION | from 192.168.1.134:51287 via tcp
Also i have tried running below app https://github.com/deepstreamIO/ds-demo-pizza-tracker
but below is what i am getting as an issue
Process: example.deepstream.io.pizzatracker, PID: 11566
io.deepstream.DeepstreamException: CONNECTION_ERROR: Can't connect! Deepstream server unreachable on 52.29.229.244:6021
at io.deepstream.DeepstreamClientAbstract.onError(DeepstreamClientAbstract.java:55)
at io.deepstream.Connection$1.run(Connection.java:163)
at java.util.Timer$TimerImpl.run(Timer.java:284)
Later i thought that server at '52.29.229.244' mite not be working. So i update ip to my local machine ip, i have got it running. But master running on terminal is not able to track the device.
Hey Aman,
I'm about to merge the websockets branches into master, and will then test out the java/android example and let you know the outcome!
Oky, but after doing restart of deepstream 1.1.1 along with 0.5 client. Things are working as expected. Master running on terminal in my mac machine is able to listen to client being connected from android devices.
Great! Will try and normalize everything by end of today so all masters are using websockets.
Thnx @yasserf Is their any way i can do load test to confirm whether things are working perfectly or not. For me to be production ready.
Hey aman,
We load tested the server in different scenarios and are currently working on a test harness for simultaneous connections. We currently managed to get up to 1million concurrent connections using websockets due to its lower footprints than engine.io.
Can you specify what kind of load test you are interested in?
Hello Yaseer,
Thnx for sharing information over test harness. I have gone over to link shared https://deepstream.io/info/performance/four-billion-messages-per-hour/ it had covered what so ever i am looking for.
Perfect!
Hi, Seen your commits with websocket changes. Can i start using it or should i wait for stable release. As i can see their is a build-failure tag marked for repo on master branch.
Also is their any possibility to get 0.5 version codebase, i have checked in tags/branches couldn't find it.
You can start using it against deepstream master, ill be doing a alpha release soon with artifacts
Hi, I have tested the latest master branch. Upon login function of java client deepstream. Its stuck as it not getting listened on server end.
As i said in starting, master running on terminal is not able to intercept incoming new connection. Any help?
Also as i guess server of deepstream 1.1.1 is working over tcp on port 6021 and for browser connection on port 6020. I guess due to which its not intercepting new incoming connection from android devices ends. As they have now been ported to websockets.
INFO | Listening for tcp connections on 0.0.0.0:6021 INFO | Listening for browser connections on 0.0.0.0:6020
INFO | logger ready
INFO | deepstream version: 1.1.1
INFO | configuration file loaded from conf/config.yml
INFO | library directory set to: /Aman/SafariDwn/deepstream.io-mac-1.1.1/lib
INFO | messageConnector ready
INFO | storage ready
INFO | cache ready
INFO | authenticationHandler ready: none
INFO | permissionHandler ready: valve permissions loaded from /Aman/SafariDwn/deepstream.io-mac-1.1.1/conf/permissions.yml
INFO | Using uws websocket server
CLUSTER_JOIN | iue0xld0-1p6wr8svgmgw4
INFO | Listening for tcp connections on 0.0.0.0:6021
INFO | Listening for browser connections on 0.0.0.0:6020
INFO | Deepstream started
INCOMING_CONNECTION | from 127.0.0.1:53702 via tcp
AUTH_SUCCESSFUL | open
Yeah, your currently using the binary version. I'm trying to get a binary built but unfortunately travis isn't enough to spit that. Will let you know as soon as it's sorted
Yes, waiting for binary releases of Deepstream server to check stuff working end to end at my end.
Can you help me how to emit event from master end to client ends for some specific devices connected. Ex. let suppose their are 10k user connected to DS (deepstream) and subscribe to some event '57fb28b9ef70ca0d6238df2d/commands' and now i want to send event from master to client to only 2k users who are connected to DS out of 10k How to emit target specific set of users only?
I think you might be looking for a different messaging paradigm. In pub-sub every client that subscribes to an event will receive the associated message on that event. For more granular sending of messages, just use more granular patterns.