You are not logged in.
Pages: 1
Yes, I noticed that, also changed BlaBla as "procedure BlaBla(const Source:string; const Destination:string; msg: string);" to have Source User, Destination User and Message in different variables. Thank you again, also for responding so quick..
Thank you very much pvn0
That worked Great!!!
I follow your recommendation and defined fconnected as an array of records and store there the callback and the info I need to preserve.
Hi,
I'm using Example 31 webSockets, projectChatServer ( simple SOA server using callbacks for a chat room) as base for my own chat program. How can I get info on active conections to server? when connected to webserver every user set a UserName, an then send messages to all other users, I would like to send a message to a specific user, so I need to identify other usernames...
In the sample code :
procedure TChatService.Join(const pseudo: string;
const callback: IChatCallback);
begin
InterfaceArrayAdd(fConnected,callback);
end;
procedure TChatService.BlaBla(const pseudo,msg: string);
var i: integer;
begin
for i := high(fConnected) downto 0 do // downwards for InterfaceArrayDelete()
try
fConnected[i].NotifyBlaBla(pseudo,msg);
except
InterfaceArrayDelete(fConnected,i); // unsubscribe the callback on failure
end;
end;
I would like to do something like
msg='DestinationUser;RealMessage'
separate msg in 'DestinationUSer' and 'RealMessage' (easy of course) and then do something like
for i := high(fConnected) downto 0 do
if fconnected[i].UserName = 'DestinationUser' then
fConnected[i].NotifyBlaBla(pseudo,'RealMesage');
Or something like
i = fconnected.findUserByName('DestinationUser' )
Fconnected[i].NotifyBlaBla(pseudo,'RealMesage');
I have been looking in the forum and I guess it should be something like
var
currSession: TAuthSession;
begin
for i := high(fConnected) downto 0 do // downwards for InterfaceArrayDelete()
begin
currSession := (fConnected[i] as TAuthSession);
currSession.UserName
...
But of course it doesn't work for fConnected...
As you can see I have no idea how to do it... Can you helpme please
(ps. Is there a way to search in the forum?, I had been reading a lot of post without luck)
Thank you BSaidus, I follow your recommendation and use fpcupdeluxe to install last versión of fixes (FPC Fixes 3.2 and Lazarus Fixes 2.0) and it worked!, now I have a working and updated copy
Solved!!!
I download last version of NewPascal.zip and it compiled and worked!!!
Thanks for your time reading this...
Hi,
I usually works with delphi, but now I need to write a chat program for windows and Linux, so I'm tryng to use Lazarus for this task. I have been reading about mormot, and I liked more the more I read about it.
I'm trying to use mORMot\SQLite3\Samples\31 - WebSockets Chat Client/Server demos (only available as delphi dpr) , as it look great as a base for my program
Using Delphi 10.3.1 and last version of mormot it compiled and worked perfectly,
but,
I downloaded last lazarus 2.04 / mormot versions, used lazarus import to convert project Project31ChatClient.lpr and compiled it. It shows 'Erorr: identifier not found : AlignTypeData' on SynFPCTypInfo.pas
Original code:
{$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
function AlignToPtr(p : pointer): pointer; inline;
begin
result := align(p,sizeof(p));
end;
{$endif}
function GetFPCTypeData(TypeInfo: PTypeInfo): PTypeData;
begin
result := PTypeData(TypInfo.AlignTypeData(PTypeData(pointer(TypeInfo)+2+PByte(pointer(TypeInfo)+1)^)));
end;
I tryed Defining FPC_REQUIRES_PROPER_ALIGNMENT and using what I believed to be the correct function in lazarus (changing TypInfo.AlignTypeData ocurrences with AlignToPtr),
compile and get error Error identifier not found 'TLibHandle', so I add uses dynlibs, now compile give me errors undefined symbols memcpy, memset, malloc, free,
so I search in mormot code and found the definicion in threee units SynCrypto.pas, SynSQLite3Static.pas and SynZLibSSE.pas, So I add 'uses SynSQLite3Static' and it finally compiles with 10 warning and 246 sugestions
I run the program in DOS window and it gave me:
An unhandled exception occurred at $00000001000D7E4F:
EInterfaceResolverException: TInterfaceResolverInjected.RegisterGlobal(): TAutoLocker does not implement IAutoLocker
$00000001000D7E4F line 58449 of ../../mORMot.pas
$00000001000D7FFD line 58466 of ../../mORMot.pas
$00000001000E33E4 line 63304 of ../../mORMot.pas
$000000010000D531
$00000001000022EE line 77 of Project31ChatClient.lpr
$0000000100002366
$0000000100013933
$0000000100014461
$00007FF804917BD4
$00007FF80552CE71
I also look in internet and found a conversion of client / server to lazarus projects in
https://github.com/synopse/mORMot/tree/ … WebSockets
Using the more recent ones (from 2 years ago) I compile and get 93 warnings, 2085 sugestions
I run the program in DOS window and it gave me EXACTLY the same as previous DOS program, if I use the original SynFPCTypInfo.pas it again shows the same mistakes
Also tryed with fpcupdeluxe, lazarus version 2.02 and same results..
As you see I tryed, but I don't now what to do now, I really likes how well it works in delphi and how simple mormot is, but I need to use lazarus to compile to linux...
Can anyone help me? Working client project in lazarus / mormot last versions would be great, but anything you can do to help me would be appreciated
Thanks in advance.
(Sorry for my bad english)
Pages: 1