You are not logged in.
Hello everyone!
I am having trouble compiling Project31SimpleEchoServer.
...
Server := TWebSocketServer.Create('8888',nil,nil,'test');
try
protocol := TWebSocketProtocolEcho.Create('meow','');
==> protocol.OnIncomingFrame := protocol.EchoFrame;
Server.WebSocketProtocols.Add(protocol);
TextColor(ccLightGreen);
writeln('WebSockets Chat Server running on localhost:8888'#13#10);
TextColor(ccWhite);
writeln('Please load Project31SimpleEchoServer.html in your browser'#13#10);
TextColor(ccLightGray);
writeln('Press [Enter] to quit'#13#10);
TextColor(ccCyan);
readln;
finally
Server.Free;
end;
...
Errors:
Project31SimpleEchoServer.dpr(46,44) Error: Wrong number of parameters specified for call to "EchoFrame"Project31SimpleEchoServer.dpr(19,34) Error: Found declaration:
EchoFrame(THttpServerResp;const TWebSocketFrame);
Could anyone tell me the reason? as
"procedure TWebSocketProtocolEcho.EchoFrame (Sender: THttpServerResp; const Frame: TWebSocketFrame);"
is compatible with the type
TOnWebSocketProtocolChatIncomingFrame = procedure (Sender: THttpServerResp; const Frame: TWebSocketFrame) of object;
I use Lazarus 2.1.0 FPC 3.3.1 I386-linux (32bits)
Offline
Hello, I already remembered how to contour this in fpc/Linux, kkk ...
protocol.OnIncomingFrame := @protocol.EchoFrame;
had already used this in another project, here is a better explanation on how this works:
https://lazarus-ccr.sourceforge.io/fpcd … 10001.2.75
Last edited by Bianco (2019-05-05 14:20:25)
Offline
This project is created for Delphi. The simplest way to compile it using Lazarus is to switch syntax mode to -MDelphi (project-options-compiler options-parsing-syntax mode).
After this you do not need any changes in sources
Offline
This project is created for Delphi. The simplest way to compile it using Lazarus is to switch syntax mode to -MDelphi (project-options-compiler options-parsing-syntax mode).
After this you do not need any changes in sources
I had already tested this project in Delphi with windows, I did not know that this option "-MDelphi" solves this in FPC / Lazarus good to know.
I will use it this way, Thank you very much @mpv!
Last edited by Bianco (2019-05-05 17:25:51)
Offline