I am trying to scale by express backend. The problem is that every time a user comes in or if I restart the server it gets a new socket.id. Plus I can't save the whole socket into memory because it gives me a [Circular JSON] problem. How do I save somepart of the socket into redis that will allow me retrieve the same socket from other servers?
Scaling express/node.js with socket.io horizontally with redis
2.1k views Asked by Ridan At
1
There are 1 answers
Related Questions in NODE.JS
- Using Puppeteer to scrape a public API only when the data changes
- How to request administrator rights?
- How do I link two models in mongoose?
- Variable inside a Variable, not updating
- Unable to Post Form Data to MongoDB because of picturepath
- Connection terminated unexpectedly while performing multi row insert using pg-promise
- Processing multiple forms in nodejs and postgresql
- Node.js Server + Socket.IO + Android Mobile Applicatoin XHR Polling Error...?
- How to change the Font Weight of a SelectValue component in React when a SelectItem is selected?
- My unban and ban commands arent showing when i put the slash
- how to make read only file/directory in Mac writable
- How can I outsource worker processes within a for loop?
- Get remote MKV file metadata using nodejs
- Adding google-profanity-words to web page
- Products aren't displayed after fetching data from mysql db (node.js & express)
Related Questions in SOCKET.IO
- How to Socket.IO Multithreading on a Raspberry Pi?
- Error while uploading the socket io chat app
- Socket.io nodejs server .NET connection
- Getting an error in Socket.io wordle project
- User is connecting to socket.io server twice
- Using Bun+Elysia+socket.io together
- Socket.io event doesn't emitting from client itself client
- Socket.io not emitting event to node server on react native
- My socket.io web socket application is not sending data to some users
- Web RTC simple peer connection with socket.io could not be established
- socket io working fine on local environment but causes problem when run using deployed site
- rasa not responding when setting the value of session_persistence: true using socket
- open-telemetry observable gauge in js - how to access field used in observable gauge inside socket.io method
- Socket io not working during deployment on vercel
- Socket.io Deployment
Related Questions in HORIZONTAL-SCALING
- Quartz Clustering in Enterprise Applications
- Entity Framework caching with ASP.NET horizontal scale
- How to setup dynamic load balancing (like in activeMQ) in IBM MQ using message grouping
- I have python django backend for webscarpping project. As input i give the website name and it scrapes data. But it takes too long time. How to scale?
- How to horizontally scale scheduler application which can dynamically create and delete cron schedules
- Horizontal scaling Asp.Net MVC5 Framework
- HorizontalPodAutoscaler deployment fails post GKE upgrade to 1.26
- How does horizontal scaling work if you only have a monolith database?
- Kubernetes autofill available resources
- How to horizontaly scale graphana?
- Optimising feedback forms backend design for gaming applications
- How does google process 600K documents in .33 seconds?
- Does mongodb sharded collection's performance deteriorate as the number of shards grow?
- Sharding in MongoDB by location but don't query with it
- Rails horizontal sharding doesn't work with unknown shard argument error on rails 6.1.7.2
Related Questions in SOCKET.IO-REDIS
- Migration issues in socket.io 2.x to 4.x in node js
- How to get rooms after adding redis
- using @socket.io/redis-adapter with pm2 in cluster mode on ec2 instance
- Unable to send socket.io event using @socket.io/redis-emitter to server which is using @socket.io/redis-adapter internally
- Server to Server events in Socket.io
- Getting missing 'error' handler on this Redis client even after giving error handlers
- How long can a ioredis connection be re-used
- What is the difference between Socket.io Redis adapter and Redis emitter
- ReferenceError: queueMicrotask is not defined at RedisSocket.cork
- TypeError on socket.io adapter
- socket.io-redis adapter timeout reached while waiting for clients response error
- How to use the postgres-adapter in Socket.io in node.js
- Socket.io not working when using multiple nodes through pm2
- How do I join a socket io room AFTER a redis subscription event happens?
- Cannot read property 'EVENT' of undefined at Namespace.emit
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
You need to decouple the user from the socket.id. The socket.id is volatile and can change even with a browser refresh. Instead, when a user socket connects, take a look at the handshake data which is passed and use that to associate the socket to the user. As far as persisting socket data in redis, that can already be handled for you using socket.io-redis.
Take a look at this link for scaling out socket.io: http://socket.io/docs/using-multiple-nodes