websocket client
Re: websocket client
There's already some updates' pushes performed in AutomationController.js, but they're implemented wrong (push requires two arguments, not one).
Generally yes, you need some kind of module which will push updates for you.
Generally yes, you need some kind of module which will push updates for you.
Re: websocket client
Has it been fixed in AutomationController.js, or is the task left for community Module developers?pofs wrote:There's already some updates' pushes performed in AutomationController.js, but they're implemented wrong (push requires two arguments, not one).
Generally yes, you need some kind of module which will push updates for you.
Re: websocket client
Well, can anyone answer the last question although it's been a while?
I still see the push in AutomationController.js source code with 1 parameter. And when connecting to the websocket nothing comes out. Ever.
It would be very beneficial to know;
- Is the websocket implementation ment to be working as it is pr. the latest version?
- Is the websocket in any way restricted by authentication, and if so, what user type needs to connect. Admin?
- Is the websocket implementation limited to local clients only?
I still see the push in AutomationController.js source code with 1 parameter. And when connecting to the websocket nothing comes out. Ever.
It would be very beneficial to know;
- Is the websocket implementation ment to be working as it is pr. the latest version?
- Is the websocket in any way restricted by authentication, and if so, what user type needs to connect. Admin?
- Is the websocket implementation limited to local clients only?
Re: websocket client
Hi,
@kenavn: source code in AutomationController.js has two parameters now but still does not seem to work.
I'm currently working on a WebSocket client for Java. The connection to the server works and I can send custom message from my Z-Way module to the Java client.
But I don't get the default messages from AutomationController.js (Ln 84-136), for example:
If I change the code as follows, I get the messages:
Any idea? Is this a Z-Way bug or a client problem? Could anyone ever receive the default messages?
Many thanks for all your help.
Regards,
Patrick
@kenavn: source code in AutomationController.js has two parameters now but still does not seem to work.
I'm currently working on a WebSocket client for Java. The connection to the server works and I can send custom message from my Z-Way module to the Java client.
Code: Select all
var message = { msg: 'Hello, World!' };
ws.push("my.custom.event", message);
Code: Select all
ws.push({
type: "me.z-wave.devices.title_update",
data: JSON.stringify(device.toJSON())
});
Code: Select all
ws.push("me.z-wave.devices.title_update", JSON.stringify(device.toJSON()));
Many thanks for all your help.
Regards,
Patrick
Re: websocket client
We do in push a JSON_stringify, so in your case it is done twice and a string comes to your client. May be client do not accept objects?
Re: websocket client
Thanks for your answer!
I have just tried again with the following code in Z-Way:
1.)
2.)
3.)
Only 1.) reaches the Java client as JSON string: {"type":"my.custom.event","data":{"msg":"Hello, World!"}}
I have also tested a JavaScript client with the same result. Only the first variant reaches the client.
If you can confirm this, please check my pull request.
Regards,
Patrick
I have just tried again with the following code in Z-Way:
1.)
Code: Select all
var message = { msg: 'Hello, World!' };
ws.push("my.custom.event", message);
Code: Select all
ws.push("plain text");
Code: Select all
ws.push({
type: "my.custom.event.default",
data: JSON.stringify(message)
});
I have also tested a JavaScript client with the same result. Only the first variant reaches the client.
If you can confirm this, please check my pull request.
Regards,
Patrick
- Attachments
-
- Z-Way app.zip
- Z-Way app (index.js)
- (867 Bytes) Downloaded 315 times
-
- JavaScript code.zip
- JavaScript client
- (383 Bytes) Downloaded 299 times
Re: websocket client
Correct! You are right. I missed the API change.
Re: websocket client
Unfortunatelly not part of v.2.2.4 release ;(
Re: websocket client
What's the difference between `ws.push()` and `ws.send()`?