Communication client-server-client

2019-08-06 04:05发布

I have a question about the Communication between a client and a server.

I would like to create a GWT application that can do the following:

The client A fires an event to the server and the server in his turn fire an event to the client B. Here the client B has to be able to listen to the event all the time.

I wanted to send some event with few data in real time to a connected client B. is that possible? and if yes how can I do that?

Thanks

3条回答
▲ chillily
2楼-- · 2019-08-06 04:55

here is one exampleof course its possible for the communication between client and server you have to use Rpc(Remote Procedure call). you can send and recieve data as a serialized objects via rpc

查看更多
做自己的国王
3楼-- · 2019-08-06 05:00

Here the client B has to be able to listen to the event all the time.

To let client wait for data, you can use Comet [1] (long lived HTTP requests) or WebSockets [2] if targetted JS runtime does support it.

[1] : http://code.google.com/p/gwt-comet/

[2] : http://code.google.com/p/gwt-ws/

查看更多
Summer. ? 凉城
4楼-- · 2019-08-06 05:00

Just store the result of client's (A's) request in a Database. and write client side code to request the content from the db, process it in the server and give the result back to the client(in your case, client B)

查看更多
登录 后发表回答