You are not logged in.
Pages: 1
TWebSocketProtocolChat has the SendFrameJson function.
Is it possible to add this function to TWebSocketProcess?
Something like:
function TWebSocketProcess.SendFrameJson(const Json: RawUtf8): boolean;
var
frame: TWebSocketFrame;
begin
frame.opcode := focText;
frame.content := [];
frame.tix := 0;
FastSetRawByteString(frame.payload, pointer(Json), length(Json)); // temp copy
result := SendFrame(frame)
end;IMO, that kind of simple examples is prefect for anyone approaching mORMot2; what for an expert is "just ..." for a newcomer is "ah, that's what I was looking for"
IMHO, I agree with you.
Thanks.
Thanks for the feedback and interest.
I guess it is just
https://github.com/synopse/mORMot2/blob … server.dpr
but using THttpWebsocketAsyncServer class, isn't it?
Almost, it also has DoOnRequest which loads the file "restws_simpleechoserver.html"
I have done Example of an asynchronous HTTP WebSocket Echo Server with TWebSocketAsyncServer.
Point your browser to http://localhost:8888/ for initial page using the existing file "restws_simpleechserver.html"
What I've noticed is that when connecting for the first time, "Sender.Protocol.ConnectionID" starts at 2 or 3, not 1.
I hope this example is helpful and can be included in the official mORMot2 GitHub repository.
Thank you very much for such excellent work.
Pages: 1