I’m trying to use a “build-less” process so I’m using a plain module script in an html file (following the Preact docs): I’m able to get the client socket.io working if I by-pass the module system and rely on the window global (note: I’m serving the html file from an http s…
Tag: socket.io
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…
Unable to connect to socket – Vanilla JS to node.js
I am trying to work with socket.io, however I am unable to establish a connection between my client (Vanilla HTML/JS) and my server (node.js). Server code: I also have several endpoints and functions that are exposed in the same file, though they didn’t seem relevant (as far as I know), so I didn’…
socket.io broadcast in a room
I am trying to use socket.io to broadcast only to users of a specific room (in another word, to send to all users in that room except me, the sender). So far, I have tried: None of them work unfortunately. Answer io.of(“/”).to(room_temp).emit(‘transcription’, data); would submit to eve…
How to stringify js object, so that multiple double quotes are possible when sending it over Socket.io
Well, i guess the main problem is defined in the title, but some special info is: Im trying to emit events to a socket.io api. For the eventtype part this is working fine, but when using JSON.stringify on the packet body (event data) part (which is supposed to be in this format: “{“msg”:R…
How to display the contents of an array as a list?
I’d like to output the contents of an array as a list: value value value However, it’s currently outputting the array like this: value,value,value What can I change to display the array contents as a vertical list? For context, this is displaying an array that updates by adding/removing items base…
How to add side effect to creating new record in Strapi by customizing controller?
I am trying to trigger a side effect (send notification, using socket.io) when adding new record in Strapi. The socket setup is OK, successfully emitting from back-end (Strapi API) to front-end. I followed the docs on customizing controllers and the recommendations in this Stack Overflow thread, but didn̵…
Unable to change camera / stream for WebRTC call
Source: https://github.com/anoek/webrtc-group-chat-example/blob/master/client.html I’m trying to modify this Webrtc example to add the ability of changing camera (Cross-browser support). Normal usage works perfectly, after changing camera, failed in renegotiation. 1) Get a list of devices via navigator.…
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 …
How can i export socket.io into other modules in nodejs?
I have socket.io working in app.js but when i am trying to call it from other modules its not creating io.connection not sure ? app.js consumer.js Answer Since app.js is usually kind of the main initialization module in your app, it will typically both initialize the web server and socket.io and will load oth…