#1 2021-02-22 18:52:02

Gregory_Les
Member
Registered: 2021-02-22
Posts: 5

WebSocket with FMX

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

Offline

#2 2021-02-23 14:52:10

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

Re: WebSocket with FMX

The client won't work on Delphi Android, because the raw mORMot units can't be compiled on this target.

Using PHP as a relay won't help.
You just need a WebSockets client for Android.

Offline

#3 2021-02-23 16:04:45

Gregory_Les
Member
Registered: 2021-02-22
Posts: 5

Re: WebSocket with FMX

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?

Offline

#4 2021-02-23 20:17:13

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

Re: WebSocket with FMX

The chat server is a WebSockets server, not a regular HTTP web client.
Please read more about what WebSockets are - see e.g. in our documentation or

I can not understand what you want to do, sorry.

Offline

#5 2021-02-23 21:22:38

Gregory_Les
Member
Registered: 2021-02-22
Posts: 5

Re: WebSocket with FMX

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()"

Offline

#6 2021-02-24 08:07:59

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

Re: WebSocket with FMX

mORMot implements the WebSockets standard, so you can access its WS server from any kind of client.
Just use the text/JSON fomat for it.
There is a JavaScript HTML sample in our folder.

I still don't understand why PHP socket_create() is relevant in your case, since WebSockets is a layer about raw TCP sockets.

Offline

Board footer

Powered by FluxBB