Giter Site home page Giter Site logo

Multiple chat rooms? about clustered-chat HOT 5 CLOSED

javeo avatar javeo commented on September 16, 2024
Multiple chat rooms?

from clustered-chat.

Comments (5)

sergiuszkierat avatar sergiuszkierat commented on September 16, 2024

@eduardofcbg, I could imagine that the multiple rooms is a next step for this activator. There are many aspects how to do it. To simplify, we can assume that we can create some static rooms so as to choose one of them on the first screen. After selecting a room, you should subscribe to an appropriate room's topic. A ChatRoom actor is only to manage a cluster communication.

We invite you to create PR in order to cooperate with code.

from clustered-chat.

eduardofcgo avatar eduardofcgo commented on September 16, 2024

@sergiuszkierat Thanks for the quick reply and I will take your invitation.
It seems easy enough to implement what you suggest. The UserSocket will take a specific room's id, which the actor will subscribe to.
A problem arises if I want to save state in a specific room. For that wouldn't I need a different actor for each one? In that case I'm having trouble getting my head around where to instantiate that actor. I guess I could create several in the controller, but what if I want to create them on demand when some user connects to a certain url?
Thanks a lot for you time.

from clustered-chat.

sergiuszkierat avatar sergiuszkierat commented on September 16, 2024

@eduardofcbg Not really, there should be only one UserSocket which is used to communicate between a user's browser and a web server. Instead of this, you should extend a ChatMessage. There should be changed a chat.coffee as well.

To have a state of your chat, you should use a persistance layer, so far a chat is volatile in his behaviour. If you switch between rooms, you should retrieve a data from server.

from clustered-chat.

eduardofcgo avatar eduardofcgo commented on September 16, 2024

I was thinking of using akka's event sourcing. Your suggestion simplifies a lot the problem, but in that case the actors will not have any actual state. I will rethink the solution.
Thanks a lot.

from clustered-chat.

sergiuszkierat avatar sergiuszkierat commented on September 16, 2024

Resolved by #5

from clustered-chat.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.