Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring websocket client and server. #1514

Merged
merged 5 commits into from
Nov 7, 2018

Conversation

slaff
Copy link
Contributor

@slaff slaff commented Nov 2, 2018

Improvements

  • Simplified and decreased the code base responsible for the Websocket functionality.
    Refactored the WebsocketConnection to be reused in server and client mode.

  • Documentation for the updated connections.

Breaking Changes (Impact: High)

If you use Websocket functionality make sure to read the notes below.

  • Renamed Websocket related types, classes and methods. We used to have WebSocket and Websocket. From now on only Websocket will be used. Example WebsocketConnection::getActiveWebSockets is now WebsocketConnection::getActiveWebsockets.

  • WebsocketConnection
    Renamed the method making the binding to a http server socket to be called bind.

  • WebsocketClient
    All methods starting with setWebSocket are shortened to set. Example: setWebSocketMessageHandler is renamed to setMessageHandler.

Fixes: #1416.

@slaff slaff force-pushed the refactoring/websocket-client-latest branch from bde7db7 to 8744c8b Compare November 5, 2018 19:04
@slaff slaff added this to the 3.7.0 milestone Nov 5, 2018
Renamed the method making the `binding` to a http server socket to be called `bind`.

Fix for potential memory leak + Codacy fixes.

Reapplied coding-standards.

Small changes.

Updated the example to update every 20 seconds instead of 60.
Better init and deinit of streams

Added timeouts to keep the connection for longer periods.

Reset the HttpConnection timeout on a new connect.

- Don't send new HTTP request over the same TCP connection if is already started.
- Make HttpConnection::reset to be extendable. This allows also the WebsocketClient to reset the connection.

Use SSL by default

Refactored the HttpClient and Connection to reuse code.
Refactored the WebsocketConnection to be reused in server and client mode.
@slaff slaff force-pushed the refactoring/websocket-client-latest branch from 8744c8b to fdfca22 Compare November 5, 2018 21:12
@slaff slaff changed the title Refactoring websocket client and server + http refactoring Refactoring websocket client and server. Nov 5, 2018
@slaff slaff force-pushed the refactoring/websocket-client-latest branch from 2f0c52a to cce7822 Compare November 6, 2018 17:12
@slaff slaff force-pushed the refactoring/websocket-client-latest branch from 51f886c to 701e161 Compare November 6, 2018 17:49
@slaff slaff merged commit 00f7f15 into SmingHub:develop Nov 7, 2018
@slaff slaff mentioned this pull request Nov 15, 2018
4 tasks
@slaff slaff deleted the refactoring/websocket-client-latest branch July 22, 2019 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants