Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
My goal
I want to create a game with different playing rooms. Playing rooms are not connected in any kind. Only the one thing: I need to be able to move a player to other room.
My thought
There will be many users playing, so it will be a good thing to use many servers and many node-instances at each server.
I use
NodeJS with SocketIO. Playing rooms are SocketIO rooms. Each player is connected to only one room.
Question
But what I should do, if I need to move a user from one room at server #1 to another room at server #2?
Methods I know
I have found methods to have connection between servers by NoSQL as Redis. I can send events like this to other rooms.
But it seems to be better thing, I will send command to my client: "disconnect from server #1, connect to server #2, to room ..." (and store all possible rooms in redis client). So, it will be direct connection, not the "server #1 -> redis -> server #2". I want it to be fast.
Main question
Is there a way to transfer client connection from one server to another, fast and simple? Or may be use Redis pub-sub is not so bad by speed and it's ok to use it? What is the best solution?
Thank you.
Redis is ok.
It's pretty fast and easy to use.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I want to show real time push notification to every user if someone started any kind off process. My project is in Angular and Node JS. If any user start some process then every user in the site should be notified by push notification
For your server side, you would need a socket solution to enable real time notification.
Since you are using NodeJs as your backend, you can try out socket.io. I personally find them quite easy to use. Their documentation can be found via their site.
https://socket.io/
If you need a step by step guide on how to combine nodeJS + socket.io + Angular, you can refer to this guide by DigitalOcean
https://www.digitalocean.com/community/tutorials/angular-socket-io
On the angular side, you need to develop a way to ensure the notification is consumed by all users. Two simple methods about this could
either be done via your state management like NGRX,
or via a global service
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I develop an application like Whatsapp using Vuejs and Nodejs. Can I create a backend for the entire application with Socket.io? Is it possible with Socket.io Rest api? I think there should be a Rest api in parts like the login. Is it true that I prepare parts like login with socket.io? Thanks in advance.
You can use a framework like NestJs or Adonis (or many others). Those that I'm mentioning are ready to build a REST service and also use websockets (with socket.io).
It is normal to use both in a project. The socket will be an open and persistent connection to the server, in the other case the http request is a petition, so ask yourself, Does this feature need constant communication with the server or could I ask for something and thats it??
Note: You can create a whole server using only sockets (socket.io in your case) but I think that a combination of ws + http is better
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I intend to create a simple mobile question-and-answer game, and some doubts have arisen about the server-side architecture of the game.
As the game will be multiplayer, I intend to use NodeJs and Socket.io, creating rooms for players to play together.
But, how to store the state of each match in each of the rooms?
I thought about saving all the information in a NoSQL database, but I don't know if it's a good idea.
Another idea I had was to use another language that supports multiple threads, creating one thread for each game started and storing the information in variables in the thread. But it also didn't seem like a good idea.
How can I do this? I am a beginner in the field of game development.
Storing things is a database's job, so yes. If your game will have few players you might look for an in-memory database. NoSQL is fine since I doubt you'll be trying to query like "select all players across all current games named Roy" since each instance of a party's game would be pretty isolated from other people's.
Your tech stack is fine.
Threads are rare and are for doing work, not sitting still holding data.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am implementing a 2-player tetris game on the web. One of my colleagues told me that I can implement it or use a web server.
Since this is a game, I think I must implement a server part. What is the point of using a web server in a game development?
The server keeps track of the game while the clients (the 2 people player Tetris) just deal with the UI and User inputs.
Server
The server should be in charge of making sure that moves are legal, calculating points, and anything else related to the rules and running of the game. This is where the logic of the game is or where the game is played.
Client
This is ONLY used for interacting with the server. There should exists a protocol between the Server and the Client. The client will only send requests to the server, wait for a response and update the UI appropriately. No game logic should be implemented here.
The purpose of the server is to talk to each of the clients and bounce data between them. If you need a server for your Tetris game you probably want to have a look into NODE.JS, PHP and WEB sockets.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
My idea was creating iOS applications where the user can enter a location. This location is stored in a remote database with the device id for push notifications.
Then the application on the remote server periodically checks the weather and when it's about to rain in one of the locations stored in the database it sends push notifications to all device ids for that location.
So basically I need to create iOS applications to store data (I like to call these "listeners") and a application for the server which connects to a weather api and sends notifications ("controller").
My idea on the controller is still kind of vague and I don't really know how to achieve this. Is it even a good idea to create an application that runs 24/7 on the server to checks the weather and sends notifications. And if not, what would be a good way to achieve something like this?
This should be the only way to do it in my opinion. You server could check for more people per update then the app could do it self. Also by using push notification you will make sure that you app is not running in the background (this is not even possible for your kind of app) and draining the battery.
A cron job that runs every so often that calls a web page, shell script, etc.. will also do. There are many option and there is no 1 answer.