News Articles sockets

Why is my callback function not working inside a nested function?

I’m using the callback function like this with Socket.io loadData(callback) { var client = new SyncClient(this.socket, this.project); client.on("connected", () => { this.values = client.getData(); callback(client); } } But I got this message in my console : Uncaught TypeError: callback is not a function when I’m calling my function loadData. I think the callback() is trying […]

TypeError: Cannot read property ‘0’ of undefined, React Chat app error

Making a chat application with Chatengine.io and React. As soon as I’ve written a code for sending images, and tried sending one image, the browser returning this error, and if the page is reloaded I’m getting the same error back. How do I fix this? This is the error I’m getting on the browser {message?.attachments?.length […]

How to send mongoDB Change Stream data to client using socket?

One of my database table name is ‘users’,i want to watch over user table, when something change on user, my socket server will send data to client My server code const userChangeStream = connection.collection(“users”).watch(); userChangeStream.on(“change”, (change) => { const user = getUser(change.fullDocument._id); switch (change.operationType) { case “replace”: user && io.of(user.socketId).emit(“getUser”, change.fullDocument ); break; } }); […]

How to keep user joined to their multiple rooms socket.io

I am completely new to socket.io and I have been stuck on this problem for so many days. I can’t find any deep youtube vidoes on this topic either. What I am trying to do is, I am creating a chat app. As soon as you log in you will see all the groups and […]

Flask SocketIo Disconnection

I keep getting WebSocket disconnection error: insufficient resources with flask-socketio and session disconnected. Any idea on how to solve this?enter image description here Source: React – Stack Overflow

Cannot GET /socket.io/1/

I have the following app with express/socket.io (the app is listening and live without any errors). When I http-request it I get the following error: GET http://localhost:3030/socket.io/1/?t=1630097351846 404 (Not Found) And on the socket.io reponse http://localhost:3030/socket.io at I get: Cannot GET /socket.io Please help !! const socket=io.connect(‘http://localhost:3030/’); //const { Socket } = require(“socket.io”); const videoGrid=document.getElementById(‘video-grid’); […]

websocket object is not connecting the socket in react native

Hy, I’m trying to connect WebSocket in react-native but it’s not connected on the first attempt. I have two screen users and a chat screen. On the users screen when I click on the user it navigates to chat screen. According to the documentation of WebSocket In order to communicate using the WebSocket protocol, you […]

php server socket & webSocket HTML5 client

what i’m trying is connect the client [webSocket] with PHP server socket my server socket will accept the socket from client, and fetch the Request headers, after receiving the Request, i sent back handshake [response] But the status for webSocket [client] is pendding and never get the response JS code: const URL = "ws://localhost:8050"; var […]

socket Io not emitting to rooms

I have been stuck with this problem for a while now . I want to emit to all the connected clients of a room when a new client joins the room. I have already seen the https://socket.io/docs/v3/emit-cheatsheet/index.html and tried all the emit methods for rooms as seen below in server code and none of them […]

Kubernetes and Socket.io 404 error – works locally but not after applying to kubernetes

Apologies in advance for such a long question, I just want to make sure I cover everything… I have a react application that is supposed to connect to a socket being run in a service that I have deployed to kubernetes. The service runs and works fine. I am able to make requests without any […]

Javascript: How can I interact with a TCP Socket API using net.connect properly?

I’m fairly new to Javascript and am trying to wrap my head around async, promises, etc. I have an application running a TCP API (non-HTTP) on the localhost. I’m building an Electron app to interact with this API. I need to send a single request to the API every second and retrieve a single JSON […]

Sending data from javascript to a python script

I’m trying to send data from Javascript to a Python script. The data should act as a function call. So a simple example would be if you press a button on a website, the python script should execute a function. Is something like that possible? Maybe a socket? Thanks in advance! Source: JavaSript – Stack […]

Authentication flow for multiple modes of communication

I have an application that makes use of HTTP REST APIs and websockets. My backend is using typescript and frontend is using React. I’ve implemented a JWT authentication system that uses access token and refresh tokens. Now I’ve implemented the refreshing tokens part on the frontend that is using axios through axios interceptors. But the […]

Use of WebSocket in react-native

Hy Community, I’m a react-native frontend developer working first time on WebSocket and that’s very difficult for me to work on that I try many youtube videos and blogs which also work for me. The backend of WebSocket done in python Django which is done by some backend developer. Now I try in react-native using […]

Use of WebSocket in react-native

Hy Community, I’m a react-native frontend developer working first time on WebSocket and that’s very difficult for me to work on that I try many youtube videos and blogs which also work for me. The backend of WebSocket done in python Django which is done by some backend developer. Now I try in react-native using […]

Use of WebSocket in react-native

Hy Community, I’m a react-native frontend developer working first time on WebSocket and that’s very difficult for me to work on that I try many youtube videos and blogs which also work for me. The backend of WebSocket done in python Django which is done by some backend developer. Now I try in react-native using […]

Use of WebSocket in react-native

Hy Community, I’m a react-native frontend developer working first time on WebSocket and that’s very difficult for me to work on that I try many youtube videos and blogs which also work for me. The backend of WebSocket done in python Django which is done by some backend developer. Now I try in react-native using […]

Use of WebSocket in react-native

Hy Community, I’m a react-native frontend developer working first time on WebSocket and that’s very difficult for me to work on that I try many youtube videos and blogs which also work for me. The backend of WebSocket done in python Django which is done by some backend developer. Now I try in react-native using […]

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.