Skip to content

Tag: websocket

javascript update view if value change

i have java script where im getting value from websocets server, is updating the view every 1 sec , i will like to have the view only to be updated when the value change (add new point on the chart ), as for now is updating every time even if the value is the same, Answer Keeping only the interval

Setting Socket.io room variables

I would like to store some information in the socket room variables, but am getting the following error: UnhandledPromiseRejectionWarning: TypeError: Cannot set property ‘host’ of undefined This is my code: If I try to log socket.roomId it would return something like rBAhx0. And when I log io.sock…

Javasript websocket.send sends [Object object]

I have a requirement, where I need to send all user actions in browser to a remote application. Like user hits a link, types in textfield / textarea, selects a choice etc. On browser side I am using Javascript to listen to events and then sending those to remove application using websocket. My code looks as b…

How are Objects with Functions Handled in Node.js?

I am currently using Node.js to handle the back-end of my website but I am unsure of how Websockets/Objects are handled together. This is a template I am using as an example of my main class. (Sends web-requests to a specific page) } This is my Main Websocket File (Stripped for simplicity) Lets say I receive …

Cannot connect to socket io server

I have bot socket IO client and server running. I want to have client communicate with server. Server initialization Client initialization Socket IO debug output I enabled debug, but socket IO debug output is not very useful anyway: Notice that the listener for connection that I added triggers, but socket IO …

JSON.parse returns string instead of object

im writing a websocket client and i would like to receive messages as json strings. For this I need a login. And if the login isn’t true i send a json string with nosuccess. JSON String: On the client I’m using this to get the string: But the type of data is a string… But why? evt.data retur…