Websocket Support in 2.0

Discussions about RaZberry - Z-Wave board for Raspberry computer
hecashit
Posts: 11
Joined: 07 Nov 2014 09:08

Re: Websocket Support in 2.0

Post by hecashit »

pofs wrote:
hecashit wrote:Don't work for me in custom JS user files inside Automation folder.
Maybe you should explain more details regarding what and where exactly you wrote.
Your file may be not executed at all, or it is just executed once on startup (when there's no clients connected yet), or hundred of other possible scenarios.
Ok, sorry for previous panic post.

I put custom script file inside automation folder and set in the home automation subsystem.

File have only this code:
test = function() {
var obj = {type: "Иванов"};
ws.push("my.custom.event", obj);
}

html page scripts same as you describe.
Than i open "localhost/JS/Run/test" and check logs in html page.

My fault that i use localhost/JS/Run/test instead if localhost/JS/Run/test().
When i try to use localhost/JS/Run/test() it start works..

Thank you :)

Appologise my English

pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Websocket Support in 2.0

Post by pz1 »

pofs wrote:If you actually need UDP, you'd better refer to @pz1 posts about UDP and OpenRemote. I'd rather write a native UDP sender, but calling netcat in a shell script also works fine.
@Pofs
How would you make this native UDP sender. I don't see any option in the JavaScript language tutorials. Also haven't found a library. I did see some solutions with node.js. Is that what you had in mind?
Since 29-12-2016 I am no longer a moderator for this forum

pofs
Posts: 688
Joined: 25 Mar 2011 19:03

Re: Websocket Support in 2.0

Post by pofs »

pz1 wrote:
pofs wrote:If you actually need UDP, you'd better refer to @pz1 posts about UDP and OpenRemote. I'd rather write a native UDP sender, but calling netcat in a shell script also works fine.
@Pofs
How would you make this native UDP sender. I don't see any option in the JavaScript language tutorials. Also haven't found a library. I did see some solutions with node.js. Is that what you had in mind?
2.0 supports native modules, so you can write a C++ library and expose it to JS. And it is quite easy to send an UDP message from C++.

pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Websocket Support in 2.0

Post by pz1 »

Thanks for pointing me in this direction. Googled a bit for existing libraries, but those are apparantly out of my league. I'll look around a bit more in the coming days.
Any chance of UDP send support in a future version?
Since 29-12-2016 I am no longer a moderator for this forum

n0ahg
Posts: 87
Joined: 08 May 2013 23:41

Re: Websocket Support in 2.0

Post by n0ahg »

pofs wrote:
pz1 wrote:
pofs wrote:If you actually need UDP, you'd better refer to @pz1 posts about UDP and OpenRemote. I'd rather write a native UDP sender, but calling netcat in a shell script also works fine.
@Pofs
How would you make this native UDP sender. I don't see any option in the JavaScript language tutorials. Also haven't found a library. I did see some solutions with node.js. Is that what you had in mind?
2.0 supports native modules, so you can write a C++ library and expose it to JS. And it is quite easy to send an UDP message from C++.
Please could you point me to the docs and examples for writing these native modules?

pofs
Posts: 688
Joined: 25 Mar 2011 19:03

Re: Websocket Support in 2.0

Post by pofs »

n0ahg wrote:Please could you point me to the docs and examples for writing these native modules?
We haven't documented it yet, but I'll publish a sample library soon. Stay tuned :)

shiphrah
Posts: 12
Joined: 21 Jan 2015 02:27

Re: Websocket Support in 2.0

Post by shiphrah »

I'm also VERY interessted in support for native modules! Any updates/infos for this yet?

pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Websocket Support in 2.0

Post by pz1 »

pofs wrote:2.0 supports native modules, so you can write a C++ library and expose it to JS. And it is quite easy to send an UDP message from C++.
I did notice this issue in Github: Make TCP/UDP module for JS. Hope it is not a very long term goal ;)

dolpheen
Posts: 119
Joined: 10 Feb 2015 00:38

Re: Websocket Support in 2.0

Post by dolpheen »

Is there any info on websocket support?
I want to use IR remote control server to publish events (via EventEmitter on devices collection) in order to control widgets.
So, then we will be able to use any standard IR controls to control home automation.
Razberry B+ 2.0.1-rc25 on ZW500 + 15 devices / Razberry B 2.0.1-rc25 on ZW300 for test

pofs
Posts: 688
Joined: 25 Mar 2011 19:03

Re: Websocket Support in 2.0

Post by pofs »

dolpheen wrote:Is there any info on websocket support?
I want to use IR remote control server to publish events (via EventEmitter on devices collection) in order to control widgets.
So, then we will be able to use any standard IR controls to control home automation.
Which kind of info? There are examples of using websockets in this thread.
Or do you need to connect to other websocket server from JS? This is not supported, but you can write a module for it.

Post Reply