#1 2015-07-14 03:15:11

gusAlmeida
Member
Registered: 2015-07-13
Posts: 2

TWebSocketProtocolRest

I work for a while with Delphi, but I'm starting recently with mORMot. I'm working on a WebSocket project. I analyzed the samples (31), especially Project31SimpleEchoServer, because I want to integrate a web application with the server. This project uses TWebSocketProtocolChat, but I did not find any example of using TWebSocketProtocolRest (I looked in google and forum). There are some practical example of the use of TWebSocketProtocolRest on server and a web client communicating with it?

Thanks!!!

Offline

#2 2015-07-14 09:27:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: TWebSocketProtocolRest

TWebSocketProtocolRest is to be used with interface-based services, and a interface parameter in a method, to supply a callback.
See http://synopse.info/files/html/Synopse% … l#TITL_149

But it supports only Delphi clients by now, not pure web clients.

For pure web clients, you need to use the raw TWebSocketProtocolChat.
But, of course, it is much less powerful.

Offline

#3 2015-07-25 19:18:30

gusAlmeida
Member
Registered: 2015-07-13
Posts: 2

Re: TWebSocketProtocolRest

Thanks for the reply!


For web I'm using TWebSocketProtocolChat, and it's great!


Just a question, can I use TLS for secure websockets connections? I didn't find examples.


Thanks!

Offline

#4 2015-07-25 21:02:58

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: TWebSocketProtocolRest

TLS is not supported yet.

Any input is welcome.

Offline

#5 2015-07-26 06:11:32

evart
Member
Registered: 2015-07-26
Posts: 1

Re: TWebSocketProtocolRest

I am a long time RAD Delphi Programmer, so Programming in Mormot way is quite difficult for me. But i'm insist to try though.
And now I've been spending my whole night, trying to Clone the Client Server Chat sample (Project31-> implementation of TWebSocketServerRest) into Highlevel VCL environment. But i keep failing.
What i'm trying to do is to visualize all the activity (Incoming Join, Message, And Who is Leaving the room) in my server mainForm via a method pointer.
For example like below:
Type TOnReadEvent= Procedure(msg: string) of Object; 
procedure TServerMainForm.OnRead();
begin
  Memo1.lines.add(msg);
  ...
end;
Then i create a method pointer property in the service interface  and  also in the class implementation.
for later, i can bind it to My TServerMainForm.OnRead method. Then I produce all the message activity manually by calling those method pointer property inside Join and NotifyBlaBla of the server service class. But, The program produced Runtime Error 217, For it seems that Declaring a Method Pointer in interface is not allowed in Delphi. But i'm not sure about that.
So would you please help me, is there any beter way to do this, is there any published method or property maybe something like the one in TWebSocketProtocolChat example which is "OnIncomingFrame" property.
Thanks Sir ! Sorry For my bad english.

Offline

Board footer

Powered by FluxBB