#1 2018-07-04 17:21:26

lainz
Member
Registered: 2018-03-09
Posts: 14

WebSockets and existing Lazarus GUI Application

Hi,

I've tested the project mORMot\SQLite3\Samples\31 - WebSockets

And works very well.

The problem I have is to include into an existing Lazarus GUI Application.

I need the WebSockets server in a separate thread, to grab data from the main form, and process it into json and send it to the web page.

I'm not using mode delphi on my application, and seems that is needed in order to use mormot. I'm wrong?

The demo can be extended using a GUI application instead of a command line one?

Thanks.

Offline

#2 2018-07-04 23:59:50

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

Re: WebSockets and existing Lazarus GUI Application

Yes, we use internally the Delphi mode... but I guess it could work if you don't mix objects from mORmot units and from other units.

Offline

#3 2018-07-05 00:03:24

lainz
Member
Registered: 2018-03-09
Posts: 14

Re: WebSockets and existing Lazarus GUI Application

I tried with no success, you or anyone can make a small demo please?

Offline

#4 2018-07-05 20:23:37

lainz
Member
Registered: 2018-03-09
Posts: 14

Re: WebSockets and existing Lazarus GUI Application

Hi, I finally managed to get this working.

But it runs only on localhost, despite I set the local ip of my machine in the websockets Add method.

fServer.AddUrlWebSocket('whatever', '8888', False, 'localhost') <-- here I use my local ip

As well I change the ip on the html file.

Offline

#5 2018-07-06 01:29:20

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

Re: WebSockets and existing Lazarus GUI Application

How did you bind the server side?

Offline

#6 2018-07-06 04:45:28

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: WebSockets and existing Lazarus GUI Application

You should do the following two thing:
1: change the port to something below 1000 ... eg 888
2: run the server as administrator

Offline

#7 2018-07-06 14:18:21

lainz
Member
Registered: 2018-03-09
Posts: 14

Re: WebSockets and existing Lazarus GUI Application

We finally used another solution:
https://github.com/codewar65/VTX_ClientServer

Offline

Board footer

Powered by FluxBB