0

Is it possible to do this way: WampSharp client app connects to a WampSharp Server, then this server sends message/call client's function?

ZedZip
  • 5,794
  • 15
  • 66
  • 119

1 Answers1

1

The client can subscribe to a topic and then you can publish to this topic, specifying in the publish options' eligible property the session id of the client.

For functions this is more tricky - you would need to register the procedure with a unique name which depends on the client's session id and then call it from the server side.

darkl
  • 569
  • 2
  • 13
  • Thank you. How do you think: what is the better way to implement such schema: Client connects to Server, then Server sends messages via this channel to the Client. I'd like to build smth like reversing tunnel to the Cloud. – ZedZip Apr 02 '17 at 08:13
  • Perhaps the client should call a procedure that creates a ephemeral topic (which is its return value) to which the client will subscribe. The server could send relevant messages to this channel. – darkl Apr 02 '17 at 09:26
  • Ok, thnx, will try it. Here: client calls remote proc(server-side) to create a topic? If I understand correctly: Client calls server-proc, it creates topic and returns value to caller, client subscribes to it, then server can send messages to this channel. – ZedZip Apr 02 '17 at 09:44
  • What is better client/server samples pair to use for this kind of scenarios? – ZedZip Apr 02 '17 at 09:48
  • You got it right. Declare a class with a WampProcedure (see reflection-based callee samples) and register it to the realm services. In that procedure, create a topic using the IWampTopicContainer api (undocumented) and start publishing to it using the realm services api (or perhaps using the IWampTopicContainer api). See also publisher api documentation. – darkl Apr 02 '17 at 14:06