There's no problem useing your plugin for connect(), send(), but for receive(), here comes the problem: Seems like it can listen correctly only once. After logging the first messages, the callback I set was no more called again.
Here's my simplified code.
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady (){
document.addEventListener(window.tlantic.plugins.socket.receiveHookName, function (ev) {
console.log(ev.metadata.data)
}
}
In fact there's a timeout set to my server. When timeout the connection will be closed. And only until then, all messages sent by my server was received and logged.
Log-in succeed. controllers.js:77
WELCOME: You have 1 unread messages.WELCOME: You have 1 unread messages.WELCOME: You have 1 unread messages. controllers.js:77
I have another client app written in go-lang working well with my server. So I am wondering:
What's the right way to use your plugin to receive tcp-socket message?
Note: I am using ionic, and all these code are embedded in a controller.
There's no problem useing your plugin for
connect()
,send()
, but forreceive()
, here comes the problem: Seems like it can listen correctly only once. After logging the first messages, the callback I set was no more called again. Here's my simplified code.In fact there's a timeout set to my server. When timeout the connection will be closed. And only until then, all messages sent by my server was received and logged.
I have another client app written in go-lang working well with my server. So I am wondering: What's the right way to use your plugin to receive tcp-socket message?
Note: I am using ionic, and all these code are embedded in a controller.