Forum > Networking and Web Programming

How to add headers and subprotocol to TWebsocketClient?

(1/2) > >>

BlueIcaro:
Hello I need connect to a server using websockets. The information about servers says:

--- Quote ---The sequence of steps involved to setup subscription and start listening for
events are:

    Subscribe on resources - Response to this HTTPS request is a list of
    initial events for the subscribed resources along with the location header.
    The value of the location header is the Web socket address.

    Retrieve the Web socket address from the Location header.

    Configure web socket Subprotocol as rws_subscription.

    Append http-session and ABBCX cookie to the web socket request's header.

    Setup secure web socket connection using the value returned from the
    location header.

    Receive events and parse the events.

--- End quote ---

Thanks

/BlueIcaro

Warfley:
If you are using LazWebsockets, you can simply use the CustomHeaders property. They will be appended to the request.

The implementation of the Subprotocol is then completely up to you. There is currently no framework for adding subprotocols more easiely, but all the "primitives" should be available.

BlueIcaro:

--- Quote from: Warfley on January 25, 2024, 09:40:35 pm ---If you are using LazWebsockets, you can simply use the CustomHeaders property. They will be appended to the request.

The implementation of the Subprotocol is then completely up to you. There is currently no framework for adding subprotocols more easiely, but all the "primitives" should be available.

--- End quote ---

Hello I tried you library and ir cover everything I need, but I opened a issue: https://github.com/Warfley/LazWebsockets/issues/36
Because I can't stop my program. So I'm studying other alternatives.

/BlueIcaro

Thaddy:
That sounds not right: is your program already written as a service/daemon?
Because that is what I would expect for a webserver application.

BlueIcaro:

--- Quote from: Thaddy on January 27, 2024, 02:53:49 pm ---That sounds not right: is your program already written as a service/daemon?
Because that is what I would expect for a webserver application.

--- End quote ---

I wrote about this here: https://forum.lazarus.freepascal.org/index.php/topic,65547.0.html
I read again, and Warffley said that there is way to solve the problem. I'll will try again.

/BlueIcaro

Navigation

[0] Message Index

[#] Next page

Go to full version