質問

I have setup an account and app in the pusher.com API dashboard and have experimented with both private and public channels and client->client events - I have no trouble doing this.

My project is using CodeIgniter (latest) PHP framework (+ jQuery latest + pusher latest) and I have access to edit everything - nothing is out of bounds in terms of solutions, this is a non commercial project.

My aim is to have client/socket A send an event/message to client/socket B within 'channelX'.

I would like many people/sockets to be possible within 'channelX' - so for example we could have 10 clients connected to this channel, but within it I would like 2 parties to be able to communicate directly with each other (can be via server or just via pusher api).

At the moment, and where my understanding and research leads me: is that any event triggered in my 'channelX' private channel is sent to all clients - now I have used the 'exclude socket' parameter to make sure the event doesn't trigger on 'socketA' (the person doing the initiating of the event) - and this works when there is only 2 clients/sockets connected to a channel - but add more parties and it gets messy.

The question: Should a channel ONLY have 2 clients/sockets if the events are only to be shared between two?

Ideally what I would like to do: Have one master channel which holds all users - then each user should be able to send a 'ping' or 'poke' to one of the other users - without all of the other clients receiving this pusher event/trigger.

I do have code but my question is really theory based and so I'm not expecting bundles of code to come from this question - but the docs on the pusher.com website kind of miss this point (or perhaps I did!)

Thanks for any input

役に立ちましたか?

解決

There is an old FAQ article on how to implement 1-to-1 chat that may provide a strategy that suits your needs.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top