Pregunta

We are attempting to provide a service where two customer devices would need to talk to each other through our servers. Each device may come online or go offline at anytime. When they are both online, they can exchange information with each other through our server.

I am inclined towards a Flex/PHP solution, however following scenarios baffle me:

1) when client device-A attempts to get some information from client device-B through my server, the incoming request from device-A will be a Flex AMF service request. How do I relay that flex request to device-B? Relaying is preferred if possible. Else, should I terminate the request from device-A on my server and originate a request to device-B?

2) when device-B responds with data to the request from device-A (discussed in (1) above), can I relay that data to device-A directly or do I need to terminate the response and send a new message to device-A with the data from device-B?

May be I am completely off-track or Flex/AMF/PHP is not the best solution. Let me know what you think.

Thanks

¿Fue útil?

Solución

I have a similar setup, even though my server is a BlazeDS Java Server and not PHP. I solved this problem by using Amf Destinations. If you are familiar with JMS, this is relatively similar. I have one public destination for inter-client-communication and one private destination for each client. When one client wants to know something from any other client it sends a message to the public destination and all clients get the request. In the request the client passes the id of its private destination. If one client gets the requests and notices that he should respond, he simply sends a response-message to the private destination that was mentioned in the request.

I hope this is what you were asking for. You could alternately send the response to the public desination. The side-effect however would be that the response would be sent to all the other clients too and this would only increase network traffic and make the clients have to filter out stuff that is not sent to them.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top