#1 2016-04-25 10:28:34

aroxing
Member
Registered: 2016-04-24
Posts: 8

Web sockets examples

Hello.
My task is to develop Delphi-based Web sockets server and also Delphi-based and Browser-based clients.
I've analized samples provided with the library but did not find the solution. What the examples have:

1) Project31SimpleEchoServer.dpr - works fine with browser example but does not have Delphi client example. I used the way described here http://synopse.info/forum/viewtopic.php?id=3120 but ran into the same error message.

2) Project31ChatServer.dpr and Project31ChatClient.dpr work together but browser-based example from 1) doesn't. I suppose because of authentication.
I can't decide how to adapt Project31SimpleEchoServer.html to these server and client.

I'd like to ask the community to help me with examples either with a "Project31SimpleEchoServer.dpr" Delphi-based client or a browser-based "Project31ChatServer.dpr and Project31ChatClient.dpr" client.

Thanks in advance.

Offline

#2 2016-05-03 09:11:10

aroxing
Member
Registered: 2016-04-24
Posts: 8

Re: Web sockets examples

I'd be very appreciate it if somebody showed me the working code of Web sockets from real project except authors' examples.

Thanks.

Last edited by aroxing (2016-05-03 09:20:34)

Offline

#3 2016-05-03 10:44:27

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: Web sockets examples

@aroxing, In my case I needed to have bought another commercial websockets library (http://websockets.esegece.com/), I've not fully integrate it into my program, but according some simple tests it worked as expected - I think they have tested with some standards.

PS, I got a forum msg sent from you saying you want to **answer** a WebSockets-related question of mine, but obviously you are wanting an anwser smile


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#4 2016-05-03 12:29:57

aroxing
Member
Registered: 2016-04-24
Posts: 8

Re: Web sockets examples

@edwinsn, thanks a lot for commenting my issue.
I'm currently on the way to use the library you mentioned. Hope their implementation will fit all my requirements.

Thanks.

Offline

#5 2016-05-04 07:29:07

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: Web sockets examples

@aroxing,

It'll be helpful to others if you report back your usage experiences later smile


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#6 2016-05-08 23:28:54

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 250

Re: Web sockets examples

another-best idea: donate some bucks to Mr. AB,
If you make any profit by using Synopse open source components, you are encouraged to donate something to Mr.AB at http://synopse.info/fossil/wiki/Synopse+OpenSource

I think you can contact Consulting services tailored to your needs f.i. "a custom interface-based implementation publishing SOA services".

If you don't have money, like me, you can transfer your gently used furniture and housewares to awesome Mr. AB,
it has been said, AB does not accept beds, mattresses and sofa sets with staining or tears. smile

Awesome Mr.AB does treat his clients with dignity and respect.

Last edited by warleyalex (2016-05-09 01:39:34)

Offline

#7 2016-05-09 06:27:25

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: Web sockets examples

warleyalex wrote:

another-best idea: donate some bucks to Mr. AB

Awesome Mr.AB does treat his clients with dignity and respect.


Done a very small donation smile


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#8 2016-09-16 20:18:44

aroxing
Member
Registered: 2016-04-24
Posts: 8

Re: Web sockets examples

edwinsn wrote:

@aroxing,

It'll be helpful to others if you report back your usage experiences later smile

I've been using the sgcWebSockets library for several months and have to admit that it works quite well. Classes interfaces are elegant and full-fledged.
My use case consists of Delphi server and Delphi and Javascript clients. I did not try native Javascript WebSockets but js library provided by sgcWebSockets solves all usual actions (connect, disconnect, message send/receive, errors handling). I definitely recommend this library when web-sockets are needed in mutual Delphi-Web environment. By the way there are several useful features like authentication, sending binary data, SSL support etc.

Offline

#9 2016-09-17 07:55:17

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: Web sockets examples

@aroxing - Does sgcWebSockets create a separate thread for each webSocket connection?

Offline

#10 2016-09-17 08:27:40

aroxing
Member
Registered: 2016-04-24
Posts: 8

Re: Web sockets examples

mpv wrote:

@aroxing - Does sgcWebSockets create a separate thread for each webSocket connection?

From the help:

TsgcWebSocketHTTPServer implements Server WebSocket Component and can handle multiple threaded client connections as TsgcWebSocketServer, and allows to server HTML pages using a built-in HTTP Server, sharing the same port for websocket connections and HTTP requests.

TsgcWebSocketServer implements Server WebSocket Component and can handle multiple threaded client connections.

TsgcWebSocketClient.... Methods :
Start: uses a secondary thread to connect to server, this prevents your application freezes while try to connect.
Stop: uses a secondary thread to disconnect from server, this prevents your application freezes while try to disconnect.

Offline

#11 2016-09-17 08:36:36

emk
Member
Registered: 2013-10-24
Posts: 96

Re: Web sockets examples

If I'm not mistaken Tsgc*** is Indy based, that means one thread per connection so you can't really used in apps where you have more than few hundreds connections.

Offline

Board footer

Powered by FluxBB