This pull request introduces a new feature that allows the connect() method in the WebsocketConnection class to control whether to accept the WebSocket connection or not.
This is done by adding a new parameter accept_connection to the connect()method. By default, this parameter is set to True, meaning the WebSocket connection will be accepted when the connect() method is called.
However, if accept_connection is set to False, the connect() method will not attempt to accept the WebSocket connection.
This feature is particularly useful in scenarios where the first message from the client after establishing the WebSocket connection is used for authentication purposes.
Fixes #86
Changelog:
Added a new parameter accept_connection to the connect() method in the WebsocketConnection class.
Added a new connection_accepted variable to track if connection was already accepted
Added new tests to verify the functionality of the accept_connection parameter.
Description
This pull request introduces a new feature that allows the
connect()
method in the WebsocketConnection class to control whether to accept the WebSocket connection or not.This is done by adding a new parameter
accept_connection
to theconnect()
method. By default, this parameter is set toTrue
, meaning the WebSocket connection will be accepted when theconnect()
method is called.However, if
accept_connection
is set toFalse
, theconnect()
method will not attempt to accept the WebSocket connection.This feature is particularly useful in scenarios where the first message from the client after establishing the WebSocket connection is used for authentication purposes.
Fixes #86
Changelog:
Added a new parameter accept_connection to the connect() method in the WebsocketConnection class. Added a new connection_accepted variable to track if connection was already accepted Added new tests to verify the functionality of the accept_connection parameter.