Code Monkey home page Code Monkey logo

Comments (4)

parasyte avatar parasyte commented on July 30, 2024

Hi. The backend service doesn't support publishing a message to multiple channels simultaneously. It would have to be implemented in the client SDK by looping through the channel list.

from ruby.

cvconover avatar cvconover commented on July 30, 2024

Samnang,
Something I did in the past using the Java SDK was to create a publisher worker thread that will publish to a specific channel. Each of those publishers will subscribe to a single master worker thread that will publish the message to those channel specific publishers which will in turn publish the message to their own channels. This is a good design pattern if it needs to be publish to all channels at the same time rather than in sequence.

To be more specific:

  • Master worker thread publishes a message on channel_master
  • Channel 1 worker thread subscribes to channel_master and publishes message received on channel1
  • Channel 2 worker thread subscribes to channel_master and publishes message received on channel2
    ...
  • Channel n worker thread subscribes to channel_master and publishes message received on channelN

Regards
Craig

from ruby.

samnang avatar samnang commented on July 30, 2024

What I try to build is private messaging between users in social mobile
application. A user can select one or few users to send messages back and
forth between them like Facebook. I'm not a good design pattern yet, but so
far I got whenever a user select one or few users, then we creat a chat in
DB with a list of members, then whenever they send a new message in that
chat, then we publish to all menbers via their private channel. Each user
has their unique private channel. What do you think?

On Tuesday, April 29, 2014, Craig Conover [email protected] wrote:

Samnang,
Something I did in the past using the Java SDK was to create a publisher
worker thread that will publish to a specific channel. Each of those
publishers will subscribe to a single master worker thread that will
publish the message to those channel specific publishers which will in turn
publish the message to their own channels. This is a good design pattern if
it needs to be publish to all channels at the same time rather than in
sequence.
Regards
Craig


Reply to this email directly or view it on GitHubhttps://github.com//issues/30#issuecomment-41592932
.

H.P (+855)16 701 721

Website: http://wowkhmer.com
Twitter: http://twitter.com/samnangchhun
LinkedIn: http://www.linkedin.com/in/samnangchhun

from ruby.

geremyCohen avatar geremyCohen commented on July 30, 2024

@samnang that is a great pattern... feel free to contact us at [email protected], and we're happy to advise you further on implementing PubNub with your app.
geremy

from ruby.

Related Issues (20)

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.