I am writing a multiplayer chess game and use Pusher for the part of the websocket server.
In any case, if I have a list of users and I select any of them and challenge them, how can I send a call to only one user? I know that I would use a client event, for example:
channel.trigger("client-challenge_member1", {some : "data"});
But this event should have already been created, I think. So can I create this event dynamically after each member subscribes? as possible in:
channel.bind("pusher:subscribed_completed", function(member) // not sure of correct syntax but... { channel.bind("client-challenge_" + member.memberID, function(data) { alert(data.Name + " is challenging you."); }); });
I would think that there is an overloaded method for trigger , for example:
channel.trigger(eventName, data, memberID)
But I do not see anything like it. Any ideas? Thanks.
David source share