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.
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).
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.
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.
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.
Please login first to submit.