WebSocket between Applications ?

0
0

Hi

I have two wisej applications that run on same IIS. Question is how could I send a websocket message between them. Simply, by using your Simple Chat example in two diffrent applications, how could I send message from one to another application.

Thank you.

  • You must to post comments
0
0

I’d need some more info for an example. I don’t quite understand what the second application should do. But…

Look athe SimpleChat example in /examples. There is a static class SimpleChatServer. You can simply add a reference to the SimpleChat assembly to your second application and from there you can:

1- Receive notifications when there is an incoming message by attaching to SimpleChatServer.IncomingMessage.

2- Join or Leave the chat using a unique name: SimpleChatServer.Join/Leave()

3-Send a message from the other app: SimpleChatServer.SendMessage(name, text).

 

  • You must to post comments
0
0

Actually I need both of them as Wisej running on the same IIS. Can you provide a sample.

  • You must to post comments
0
0

I’m not fully sure I understood. You have a chat-type app (A) as a wisej web app running in IIS. Then you have a similar app (B) running as a windows console app that also wants to chat with A?

If that’s the case, it would be very hard to emulate a websocket client in a console app. This is more a case for a web service that you can use from B.

If A and B are both running in IIS, I’d use an event model, one of the two or both can publish static events and subscribe to each other’s.

  • You must to post comments
0
0

Thanks Luca. My case is;

I am trying to do an application like google cloud messaging by using wisej. For example, I can have a list of authanticeted users’s sessionids from A application. A app already has websocket lines with sessionids in background and chat works inside it. From B application, that can also be a win console app, we opens a websocket connection to A application by using sessionids. Then from B app I am sending a message and on the A app the Application.Update event trigered. So messege can be delivered from B to A.

Is this possible. If yes, can you provide me an example or extend your Simple Chat example.

Thank you.

  • You must to post comments
0
0

Hi Adil,

WebSocket is a browser feature, you cannot open a websocket client from a server process. (you could using a browser process, or creating a websocket client, but it’s extremely messy).

If your apps are on the same IIS and on the same  pool they can share static variables making it very easy for two or more apps to communicate by sharing memory.

HTH

/Luca

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.