openWRT: create a web socket - websocket

I need to create an auto-start app on the openWRT router which creates persistent web socket connection to a server with public ip. Anyone knows which module can do this ?

Related

Updating a Web Socket from Outside the Web Socket App

If I have an app (let's Express.js app) with a web socket (socket.io) and I want to send message to a client from a different server app, what is the best way to go about that.
Let's assume that both apps are on a public cloud and running on separate containers or VMs. What's the best way to ensure that the message is sent to the right web socket app instance that holds the connection to the client?
You can use redis to ensure that client will get the message no matter which instance of app is sending the message.
But if your other app is a completely different app and does not start a socket server, You can still use socket.io emitter (along with redis adaptor) to send messages to clients without creating another socket server.

Is it possible to change the IP address of a Javascript Paho MQTT client after Creating it?

I'm writing a web application in javascript where I want a single Paho.MQTT.Client to be able to disconnect from an MQTT broker, and connect it to another MQTT broker with a different IP address.
Is this possible?
Or do I have to delete my existing Paho.MQTT.Client and create a new one with a different IP address in order to switch between different MQTT brokers?
I've tried myClient._setHost("a.b.c.d"); and that returns 'Unsupported', even after a call to myClient.disconnect().
You have to create a new instance of the client to change which broker it is connected to once connect() has been called.
the _setHost() function is internal only (not listed as part of the public API) and should not be used.

Connecting to a Socket.IO server running in Node-Red on IBM Bluemix

I've set up a Node-Red instance on IBM Cloud with a Socket.IO server using node-red-contrib-socketio.
I was able to subscribe to events on port 3000 on my local host fine but I'm having difficulty doing the same with the Node-Red instance on IBM Cloud.
According to my client console I seem to be able to connect but get no response using the following URL: ws://MYAPP.eu-gb.mybluemix.net/red:3000/socket.io/?EIO=3&transport=websocket Is this correct or should I be using something else like ws://MYAPP.eu-gb.mybluemix.net:3000/socket.io/?EIO=3&transport=websocket ?
Is any further configuration required in IBM Cloud to enable the connection?
If I need to authenticate within the URL I pass to the server is there a particular way that string should be structured?
Many thanks,
This will not work on Bluemix.
The Bluemix router only forwards external traffic on ports 80 and 443 (http/https) to apps.
But the app may not be actually listening on those ports (The port to listen on is passed in to the application on start up in a environment variable).
You can not just pick an arbitrary ports and listen on.

Can we create windows service app as server with Socket?

I already have a server app that can listen Tcp client but i want to create windows service app with that functionality, can this possible ?? If yes then how??

How to listen to a TCP port to detect changes in the server?

I'm working on mac os x. I'm trying to build a cocoa app working on a storage server (similar to Dropbox) that does something whenever a file is added,removed..I have already a client app installed on the mac that shows all the files stored on the server and I need to listen to the port that the server is using to send changes notification to the app. I've started following some tutorials for Sockets but I get "Address already in use".
The Question: are sockets the only way to listen to a port and if yes is there a way to build a socket to listen to an already existing server/client connection?
If a process is already listening on a port then no other process can bind(2) to that port. Alternatives would include to have a proxy listen on that port that would deal with events and then pass them on elsewhere (the client app may not play well with this), or to use firewall rules to duplicate the packets to some other port that your app would then listen on, or maybe the client application issues notifications that then can be acted on.
https://github.com/thrig/lognots
Is one way to inspect the notifications available.
Remember that listening on a port is how you prepare to receive incoming connections. It is not necessary to receive data — once a connection is established, data can flow in both directions! It is almost never appropriate for a client application to listen on a port; that's usually only appropriate for server applications.
With that in mind: Your client application should connect to a port on the server, and the server will send data to the client as appropriate.

Resources