Skip to content
Advertisement

Tag: websocket

where can i find documents for WebSocket.Server.on method?

I am learning WebSocket in JavaScript, using [ws][1] and I read most of the Docs, related to it, but i couldn’t find any Documents for “on” method or function, As i like to know how this “on” method works. if anyone are familiar with this “on” method, in the WebSocket.Server , i would appreciate it, if could help me with

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.sockets.adapter.rooms, I get the following: However, when I try to log io.sockets.adapter.rooms[socket.roomId], it returns

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 below. Let’s say I

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 data from the WebSocket

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 does nothing. What did not help so far: Removing

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 returns: data returns:

Advertisement