#1 Re: mORMot 1 » TWebSocketServer administration of connections » 2021-02-25 17:54:10

ab wrote:

The main WebSockets process loop indeed checks for the Terminated flag, and close the connection when detected.

This sounds like detecting a user who disconnected by himself.
My intention was to kick a User who didn't have permission to join the connection.


In the meantime i found out that the Procedure "HttpServerWebSocketUpgrade"
can prevent a user from login.
With checking for "ORIGIN" and "SEC-WEBSOCKET-PROTOCOL" there are two parameter, that a unwanted user does not know.
It's probably laughable, but at least a sparkle of safety.

Additional it would't be bad to limit the incomming frames per minute or/and the size of binary payload.
Im sure the event TWebSocketProtocolEcho.OnIncomingFrame is too late for checking this, isn't it?

#2 mORMot 1 » TWebSocketServer administration of connections » 2021-02-24 22:28:22

Gregory_Les
Replies: 3

Hello,

i try to build a simple chat using the SimpleEchoServer project.
This works well but I missing the ability to determine who is allowed to connect.

Is there a possibility to specifically disconnect a user by the server?



---EDIT---
In the event assigned to TWebSocketProtocolEcho.OnIncomingFrame is a reference to Sender: THttpServerResp;
There is a procedure Sender.Terminate;
Im unsure if this is the best way to do this, but it seems to work.

#3 Re: mORMot 1 » WebSocket with FMX » 2021-02-23 21:22:38

I want to connect to the chat server with a browser based WebSocket client.
Many Browsers have this functionality.
Using Java script you can establish a connection to a WebSocket Server.

Something like this: http://www.websocket.org/echo.html

Most of the demos don't have encryption or compression so i set the following line in the server code:
HttpServer.WebSocketsEnable(Server,'',false,false).Settings.SetFullLog;

So the question:
Is the mORMot WebSocket compatible to the WebSocket that Server can provide in php with "socket_create()"

#4 Re: mORMot 1 » WebSocket with FMX » 2021-02-23 16:04:45

Okay.
For testing purposes i tried to connect web based clients to the chat server.
All four scripts won't connect to the server.
The Server wrote every time "WebSocketProcessUpgrade failed as 400"

The only thing i have changed is: HttpServer.WebSocketsEnable(Server,'',true,false).Settings.SetFullLog;
I tried also: HttpServer.WebSocketsEnable(Server,'',false,false).Settings.SetFullLog;

Is it possible to connect a web client to the chat server? If yes, what do i need to change else?

#5 mORMot 1 » WebSocket with FMX » 2021-02-22 18:52:02

Gregory_Les
Replies: 5

Hello,

i tested the project 31 (chat).
Is there any chance to run it under android?

If not, will php help?
Something like the following: Android App with IdHTTP-> php on external server for establish the websocket connection-> chat Server 

regards, Andreas

Board footer

Powered by FluxBB