Git Product home page Git Product logo

Comments (12)

ericz avatar ericz commented on July 20, 2024

Hi alsonkemp,

We're working on a feature with this functionality that will be released soon. Thanks!

from now.

ericz avatar ericz commented on July 20, 2024

Hi @alsonkemp,

I've just built this feature.

00377ea

use it as follows:

 nowjs.getClient("some-client-id", function(){
      this.now.whatever():
      // this.user.clientId == "some-client-id" // true
 });

from now.

amitda avatar amitda commented on July 20, 2024

Can someone write a simple example to send a message to a client id?

from now.

ericz avatar ericz commented on July 20, 2024

nowjs.getClient(clientId, function(){

this.now.someFunction();

});

Eric

On Mon, Jun 13, 2011 at 9:07 PM, amitda <
[email protected]>wrote:

Can someone write a simple example to send a message to a client id?

Reply to this email directly or view it on GitHub:
#33 (comment)

510-691-3951
EECS Student at UC Berkeley
http://ericzhang.com

from now.

amitda avatar amitda commented on July 20, 2024

Thanks Eric.

Is there a way of integrating this into multi-room chat example?

from now.

ericz avatar ericz commented on July 20, 2024

Yep it can definitely be integrated but the multi-room chat example does not have any of the user interface necessary to integrate it.

from now.

amitda avatar amitda commented on July 20, 2024

I am working on it now... if I am successful, I will upload it here

from now.

ericz avatar ericz commented on July 20, 2024

Great to hear! Let me know if you need further help.

Eric

On Mon, Jun 13, 2011 at 9:23 PM, amitda <
[email protected]>wrote:

I am working on it now... if I am successful, I will upload it here

Reply to this email directly or view it on GitHub:
#33 (comment)

510-691-3951
EECS Student at UC Berkeley
http://ericzhang.com

from now.

lucj avatar lucj commented on July 20, 2024

Hello,

Is there an error callback function on now.getClient in case the socket is closed or does not exist ?

Thanks a lot,
Luc

from now.

jaycrossler avatar jaycrossler commented on July 20, 2024

Is there a best practice on knowing which clientId to use with getClient? Should we use a userID that already exists? Pull the clientID from the socket.io (and if so, any examples how best to)?

I'm trying to implement a multi-room chat session, where users can join and leave rooms, but still missing exactly how to tell a group that a user should be added or removed from a room.

from now.

ericz avatar ericz commented on July 20, 2024

Hi Jay,

The best way is to use the this.user.clientId which is available whenever
this.now and this.user are available.

One way to do what you describe i using the join event

mygroup.on('join', function(){

mygroup.now.notify(this.user.clientId + ' has joined');

// this.user.clientId can also be stored for use in nowjs.getClient later

});

On Wed, Sep 28, 2011 at 4:52 PM, Jay Crossler <
[email protected]>wrote:

Is there a best practice on knowing which clientId to use with getClient?
Should we use a userID that already exists? Pull the clientID from the
socket.io (and if so, any examples how best to)?

I'm trying to implement a multi-room chat session, where users can join and
leave rooms, but still missing exactly how to tell a group that a user
should be added or removed from a room.

Reply to this email directly or view it on GitHub:
#33 (comment)

510-691-3951
EECS Student at UC Berkeley
http://ericzhang.com

from now.

jaycrossler avatar jaycrossler commented on July 20, 2024

Awesome, that helped alot. I was googling it but not quite understanding until you gave me that hint. I've now got groups working across all my rooms, with the group being joined by the client, but verified that they have membership by the server and then aligned to the group._id from the database. Yay!

from now.

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.