Tuesday, 03 May 2022
  5 Replies
  1.1K Visits
  Subscribe
Hola Sergio, is there a property I can set for websocket client and server that will compress the payload?

Thanks,
James
2 years ago
·
#1042
Accepted Answer
Hello,

Yes, enable the property


Extensions.Permessage_Deflate.Enabled := True


In server and client components. This is enough to enable websocket compression.

Kind Regards,
Sergio
2 years ago
·
#1056
Hello,

For linux will be "libz" plus a version if exists (example: libz.so.1). This is defined in the file sgcIdZlibHeaders


{$IFDEF UNIX}
const
//The extensions will be resolved by IdGlobal.HackLoad
//This is a little messy because symbolic links to libraries may not always be the same
//in various Unix types. Even then, there could possibly be differences.
libzlib = 'libz';
// TODO: setup this array more like the SSLDLLVers arrays in the IdSSLOpenSSLHeaders unit...
libvers : array [0..3] of string = ('.1','','.3','.2');
{$ENDIF}


Kind Regards,
Sergio
2 years ago
·
#1055
Works perfect. Assume there is a companion "so" for linux as well. I found the dll on the web, but looks like zlibwapi might be just zlib on linux.

Thanks,
James
2 years ago
·
#1054
Hi,

Lazarus requires to deploy the zlibwapi.dll, you can download this library from your private account:


/sgcwebsockets/libraries/zlib


Just copy the library in the same folder where is your executable.

Kind Regards,
Sergio
2 years ago
·
#1053
Sergio, here's some followup.

Made sure to set this as instructed in the properties sheet on the client side: "Extensions.Permessage_Deflate.Enabled := True"

Sending this message:
'<xxactionxx>xxechoxx</xxactionxx><xxdataxx><msg>VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2cncyBiYWNrIDAxMjM0NTY3ODkgdGltZXMu</msg></xxdataxx><b64>1</b64>'

Get an exception. Clips attached. Using Laz 2.2.0 with included FPC.

Thanks,
James
2 years ago
·
#1042
Accepted Answer
Hello,

Yes, enable the property


Extensions.Permessage_Deflate.Enabled := True


In server and client components. This is enough to enable websocket compression.

Kind Regards,
Sergio
  • Page :
  • 1
There are no replies made for this post yet.
Submit Your Response
Upload files or images for this discussion by clicking on the upload button below.
Supported: gif,jpg,png,jpeg,zip,rar,pdf,pas,dfm,dpr,dproj,dpk
· Insert · Remove
  Upload Files (Maximum 10MB)