Replies: 1 comment
-
Hi! Are you sure |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I'm new to web development and I discover a bunch of new tools that are fun to use, but I'm struggling since two days trying to do an easy stuff with socket.io.
Quick explanations :
I have some User connected to the client-side of my app, and I want to list them by their ID on the server-side.
So I want to make two functions on server-side that can handle connection and disconnection of my users, and pass userID to these functions.
My code client-side :
and my code server-side :
For a reasons that I ignore, when I remove the commentary of this line (server-side) :
// this.server.emit('simulatedUserId', simulatedUserId);
The server crash, and the error output is this one (I use this emit to send client-side all the userID of client who connect/deconnect to my server) :
/home/user/Documents/project_name/srcs/backend/node_modules/socket.io-parser/build/cjs/is-binary.js:28
function hasBinary(obj, toJSON) {
^
RangeError: Maximum call stack size exceeded
at hasBinary (/home/polo/Documents/transcendance/srcs/backend/node_modules/socket.io-parser/build/cjs/is-binary.js:28:19)
at hasBinary (/home/polo/Documents/transcendance/srcs/backend/node_modules/socket.io-parser/build/cjs/is-binary.js:49:63)
at hasBinary (/home/polo/Documents/transcendance/srcs/backend/node_modules/socket.io-parser/build/cjs/is-binary.js:49:63)
at hasBinary (/home/polo/Documents/transcendance/srcs/backend/node_modules/socket.io-parser/build/cjs/is-binary.js:49:63)
at hasBinary (/home/polo/Documents/transcendance/srcs/backend/node_modules/socket.io-parser/build/cjs/is-binary.js:49:63)
at hasBinary (/home/polo/Documents/transcendance/srcs/backend/node_modules/socket.io-parser/build/cjs/is-binary.js:49:63)
at hasBinary (/home/polo/Documents/transcendance/srcs/backend/node_modules/socket.io-parser/build/cjs/is-binary.js:49:63)
at hasBinary (/home/polo/Documents/transcendance/srcs/backend/node_modules/socket.io-parser/build/cjs/is-binary.js:49:63)
at hasBinary (/home/polo/Documents/transcendance/srcs/backend/node_modules/socket.io-parser/build/cjs/is-binary.js:49:63)
at hasBinary (/home/polo/Documents/transcendance/srcs/backend/node_modules/socket.io-parser/build/cjs/is-binary.js:49:63)
I can also see some errors in the console of the browser :
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:4000/socket.io/?EIO=4&transport=polling&t=OZfBn95. (Reason: CORS request did not succeed). Status code: (null).
I tried :
For informations, here is my main.ts :
PS : If you need more info, feel free to ask, I'll answer !
PS2 : sorry for potentials errors in english, i'm not yet fluent. This is my first github post, so if there is anything that I didnt respected, i can modify that.
Thanks for your help !
EDIT by @darrachequesne: format code blocks
Beta Was this translation helpful? Give feedback.
All reactions