U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ Core » Way to decode websocket frames?
Way to decode websocket frames? [message #59046] Thu, 20 October 2022 13:17 Go to next message
Wermann33 is currently offline  Wermann33
Messages: 12
Registered: October 2022
Location: Vienna
Promising Member
Hi!

Is there a way implemented in U++ Websocket to decode the frames received as Websocket client I oversee?
The String Text get by WebSocket::Receive() is encoded (for example "/233/234...") Sad

Thanks
Re: Way to decode websocket frames? [message #59047 is a reply to message #59046] Thu, 20 October 2022 19:11 Go to previous messageGo to next message
omari is currently offline  omari
Messages: 276
Registered: March 2010
Experienced Member
Hi,

by default, in the Upp implementation, we accept frame compression when the server can do it.
the frame then is zip compressed, but without header.

as a quik solution, you can disable compression :

in the file: upp\uppsrc\Core\WebSocket.cpp, comment out ( or remove) the line (27)
//		"Sec-WebSocket-Extensions: permessage-deflate\r\n"

regards,
Abdelghani OMARI.


regards
omari.

[Updated on: Sat, 22 October 2022 08:44]

Report message to a moderator

Re: Way to decode websocket frames? [message #59050 is a reply to message #59047] Fri, 21 October 2022 07:25 Go to previous messageGo to next message
Wermann33 is currently offline  Wermann33
Messages: 12
Registered: October 2022
Location: Vienna
Promising Member
Thank you very much for your reply Abdelghani!!

That helped me a lot!

Only out of interest: do you know how to decompress the message, if permessage-deflate isnt out-commented?
With extra libraries?

Best regards and thank you again!
Joe
Re: Way to decode websocket frames? [message #59053 is a reply to message #59050] Sat, 22 October 2022 08:43 Go to previous messageGo to next message
omari is currently offline  omari
Messages: 276
Registered: March 2010
Experienced Member
Hi,

Zlib is included in U++.


String ZDecompressWS(String s){

	StringStream out;
	MemReadStream in(~s, s.GetCount());
	ZDecompress(out, in, in.GetLeft(), [](int64, int64){ return true;}, false);
	
	return out.GetResult();
	
}


regard,
Abdelghani OMARI.


regards
omari.
Re: Way to decode websocket frames? [message #59060 is a reply to message #59053] Mon, 24 October 2022 08:48 Go to previous message
Wermann33 is currently offline  Wermann33
Messages: 12
Registered: October 2022
Location: Vienna
Promising Member
thank you
Previous Topic: v14609 GetHashValue compilation error
Next Topic: Windows ProgramData directory
Goto Forum:
  


Current Time: Mon Apr 27 12:18:25 GMT+2 2026

Total time taken to generate the page: 0.01390 seconds