I have some questions:
This tutorial is about Async, but, technically, you are holding a connection in your Server Method with the fact that you are in an infinite loop.
To be truly async, should the body of the server method be moved to a task which runs each second and checks if each WebSocket has written something and then do the work required?
At the moment when ProcessMessage occurs, each Websocket is opened twice, one for the initial call (now running as an infinite loop), and once when OpenServer is called with its websocketid.
Would this not consume 2 connections, not necessarily 2 licenses, but 2 connections?
Just for clarity:
Right now, we are sync from client to server, but async server to client.
PLEASE NOTE: I understand that for a chat application, this is probably the best way to go.
User bio
404 bio not found
Member since Mar 9, 2016
Posts:
Robert has not published any posts yet.
Replies:
Certifications & Credly badges:
Robert has no Certifications & Credly badges yet.
Global Masters badges:
Robert has no Global Masters badges yet.
Followers:
Robert has no followers yet.
Following:
Robert has not followed anybody yet.
I see what you are saying, but according to the docs, in pure Async mode, there is basically no code in the Server method, it just does a quit $$$OK.
Request -> WebSocket Class -> Store the Websocket ID -> Exit (but do not call EndServer). This cache process then goes away. CSP is keeping the socket alive, as per the standard, ie as per the documentation, it doesn't need a cache process running to keep the connection alive.
You can then use a Task to periodically do a read on the Websockets, if you are interested.
This does not hold a license, basically the CSP gateway holds the data in it's pool, and at any time, a process can open the WebSocket via OpenServer and Read/Write the socket. Inside read is a call to ReadAsync if SharedConnection = 1.
BTW I have tried this and it works a treat. This would be good for say a Dashboard that really doesn't need to send data from the client to the Server, but the server can send whenever it is ready.
This mode of operation is not "realtime" which, say, a chat client would need.
Please feel free to let me know if my thinking is out of whack, but I don't think it is :)