Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

sywebsocket

WebSocket Server and Client

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

sywebsocket

Websocket Server and Client for Lazarus Applications.

Requirements:

https://github.com/svn2github/Ararat-Synapse/tree/master/trunk

For Windows:

TESTED

For Ubuntu:

TESTED

Example

pascal
var
  FWebSocket: TsyWebSocketServer;  

begin
  FWebSocket := TsyWebSocketServer.Create(8081);
  FWebSocket.OnTextMessage := @OnTextMessage;
  FWebSocket.Start;
end;            

procedure OnTextMessage(Sender: TObject);
var
  val: TMessageRecord;
begin
  if not Assigned(FWebSocket) then
    exit;
  while FWebSocket.MessageQueue.TotalItemsPushed <> FWebSocket.MessageQueue.TotalItemsPopped do
  begin
    FWebSocket.MessageQueue.PopItemTimeout(val, 100);
    if val.Opcode = optText then
    begin
      Memo1.Lines.Add(IntToStr(TsyConnectedClient(val.Sender).Tag) + ': ' + val.Message);
    end;
  end;
end;

Page for test https://www.websocket.org/echo.html

RFC 6455

Server test result

Autobahn WebSocket Testsuite v0.8.0/v0.10.9. results. (https://github.com/crossbario/autobahn-testsuitee