Code-Sharp / WampSharp

A C# implementation of WAMP (The Web Application Messaging Protocol)
http://wampsharp.net
Other
385 stars 83 forks source link

How to run the samples? #318

Closed Dinglebarry9 closed 4 years ago

Dinglebarry9 commented 4 years ago

Wampsharp.net reflection and rx publisher/subscriber samples do not include a Main function and I am not sure how to call Run()?

darkl commented 4 years ago

Run is the Main function. You can change Run to public static async Task MainAsync(string[] args). All these examples also appear (in a more sophisticated way) as csprojs of the WampSharp solution.

Dinglebarry9 commented 4 years ago

Thanks for the help. The csproj fails to restore for me. I got the getting started and raw pub/sub to work fine, the reflection pub/sub runs but the subscriber doesn't seem to be receiving anything? Do you have to add a line to subscribe to a certain WampTopic?

darkl commented 4 years ago

You need to run two different processes for the subscriber and the publisher, by default a subscriber does not receive its own publications. Another option is to register the publisher with a IPublisherRegistrationInterceptor with PublishOptions specifying ExcludeMe = false.

Dinglebarry9 commented 4 years ago

Yes I have 2 processes, the publisher and subscriber from the example.

darkl commented 4 years ago

Did you call RegisterPublisher and RegisterSubscriber? Try adding await Task.Yield(); before the Console.ReadLine();.

darkl commented 4 years ago

The examples don't have a Console.ReadLine(); but just add as the last two lines of your MainAsync the lines

await Task.Yield();
Console.ReadLine();
Dinglebarry9 commented 4 years ago

That was it I was going by the the WampSharp.net examples. This worked thank you very much.

darkl commented 4 years ago

I will update them to include these lines.

darkl commented 4 years ago

Done.