flagarde
882081536c
Fix IXWebSocketMessage.h:35:15: warning: ‘webSocketMessageType’ may be used uninitialized in this function [-Wmaybe-uninitialized] ( #328 )
2021-11-24 08:33:09 -08:00
Benjamin Sergeant
30bcddb99f
(ws) ws connect has a -g option to gzip decompress messages for API such as the websocket Huobi Global.
2021-06-08 09:49:27 -07:00
Nikos Athanasiou
c2d497abc5
Avoid returning references that are mutex protected ( #297 )
...
* Fix unsafe calls and safeguard WebSocketMessage from being called w/
temporaries
* Use unnamed namespace to express internal linkage
* Avoid returning references that are mutex protected
Motivation for this MR
The antipattern of returning references to mutex protected members was
removed. Since a caller can hold the reference it would make all class
level locking meaningless.
Instead values are returned. The IXWebSocketPerMessageDeflateOptions
class was shrunk by 7 bytes (1 padding + 2*3) after changing the int
members to the used uint8_t; side effects of that were handled.
An inefficient "string -> int" was replaced by standard library. As
seen here http://coliru.stacked-crooked.com/a/46b5990bafb9c626 this
gives an order of magnitude better performance.
2021-06-05 11:23:18 -07:00
Nikos Athanasiou
26897b2425
Fix unsafe calls and safeguard WebSocketMessage ( #294 )
...
* Fix unsafe calls and safeguard WebSocketMessage from being called w/
temporaries
* Use unnamed namespace to express internal linkage
2021-06-03 18:39:38 -07:00
Benjamin Sergeant
d26664fccc
(ixwebsocket) New option to set the min wait between reconnection attempts. Still default to 1ms. (setMinWaitBetweenReconnectionRetries).
2021-03-23 07:33:48 -07:00
Benjamin Sergeant
0813eb1788
mention disablePerMessageDeflate in the doc
2021-03-16 09:56:08 -07:00
Duncan Ogilvie
d739662a7c
Allow customizing the websocket handshake timeout ( #264 )
2021-03-07 19:23:43 -08:00
Benjamin Sergeant
8f5134528b
(ixwebsocket) use a C++11 compatible make_unique shim
2020-11-15 09:56:54 -08:00
Benjamin Sergeant
d525c28907
(cobra connection and bots) set an HTTP header when connecting to help with debugging bots
2020-09-18 15:11:20 -07:00
Benjamin Sergeant
12f36b61ff
(websocket server) Handle programmer error when the server callback is not registered properly ( fix #227 )
2020-08-06 04:40:32 -07:00
Benjamin Sergeant
0f026c5da2
(websocket client) reset WebSocketTransport onClose callback in the WebSocket destructor
2020-07-24 10:03:29 -07:00
Benjamin Sergeant
432f0570f4
(websocket) WebSocketMessagePtr is a unique_ptr instead of a shared_ptr
2020-04-13 21:56:01 -07:00
Benjamin Sergeant
179e17895d
unique_ptr for sockets
2020-03-24 12:48:55 -07:00
Benjamin Sergeant
5ce846f48b
indent files
2020-03-20 17:00:18 -07:00
Benjamin Sergeant
6085839ef7
minor refactoring
2020-03-18 11:45:28 -07:00
Benjamin Sergeant
b287730c19
Simplify ping/pong based heartbeat implementation
2020-03-18 01:14:08 -07:00
Benjamin Sergeant
e15a2900e7
(websocket) traffic tracker received bytes is message size while it should be wire size
2020-02-26 11:24:41 -08:00
Benjamin Sergeant
8837d5e784
(websocket server) fix regression from 8.1.2, where per-deflate message compression was always disabled
2020-02-22 10:15:43 -08:00
Benjamin Sergeant
242c945400
(client + server) Fix #155 / http header parser should treat the space(s) after the : delimiter as optional. Fixing this bug made us discover that websocket sub-protocols are not properly serialiazed, but start with a ,
2020-02-21 14:05:38 -08:00
Benjamin Sergeant
86d3fc8621
quit checkConnection after sleeping if requested to stop (iterate on #151 )
2020-01-28 10:46:04 -08:00
Benjamin Sergeant
422c7ff855
wait with a condition variable instead of a this_thread::sleep_for so that waiting can be cancelled when we stop/shutdown the data thread (see #151 )
2020-01-28 10:04:32 -08:00
Benjamin Sergeant
c3a619f114
Add client support for websocket subprotocol. Look for the new addSubProtocol method for details
2019-10-13 13:37:34 -07:00
Benjamin Sergeant
afed387bcf
Socket Factory has only one function which works for server and client code, and can do tls for both
2019-09-30 22:06:46 -07:00
Benjamin Sergeant
313949f087
SocketServer::handleConnection takes an std::shared_ptr<Socket> instead of a file descriptor
2019-09-30 21:48:55 -07:00
Benjamin Sergeant
cd3c9d879c
reformat everything with clang-format
2019-09-23 10:25:23 -07:00
Matt DeBoer
408ee41990
WIP: support configurable certificates/keys, and root trust CAs ( #114 )
...
* wip: tls options implemented in openssl
* update naming, remove #define guard
* assert compiled with USE_TLS for tls options
* apply autoformatter
* include tls options impl
* style cleanup; auto ssl_err
* ssl_err -> sslErr
* be explicit about SSL_VERIFY_NONE
2019-09-22 18:06:15 -07:00
Benjamin Sergeant
f9dc460325
cobra publish fix
2019-09-05 14:31:28 -07:00
Benjamin Sergeant
51799353a6
Sending invalid UTF-8 TEXT message should fail and close the connection (fix remaining autobahn test: 6.X UTF-8 Handling)
2019-09-03 14:12:40 -07:00
Benjamin Sergeant
3ad13a592d
Framentation: data and continuation blocks received out of order (fix autobahn test: 5.9 through 5.20 Fragmentation)
2019-09-03 12:02:56 -07:00
Benjamin Sergeant
55934918ff
Sending invalid UTF-8 TEXT message should fail and close the connection (fix **tons** of autobahn test: 6.X UTF-8 Handling)
2019-09-03 10:30:22 -07:00
Benjamin Sergeant
b5b0de2083
+add utf-8 validation code, not hooked up properly yet
...
+ws autobahn / Add code to test websocket client compliance with the autobahn test-suite
+Ping received with a payload too large (> 125 bytes) trigger a connection closure
+cobra / add tracking about published messages
+cobra / publish returns a message id, that can be used when
+cobra / new message type in the message received handler when publish/ok is received (can be used to implement an ack system).
2019-08-31 16:47:10 -07:00
Benjamin Sergeant
7a73ec7c06
New option to cap the max wait between reconnection attempts. Still default to 10s. (setMaxWaitBetweenReconnectionRetries) ( #108 )
2019-08-30 12:46:35 -07:00
Benjamin Sergeant
d3e5a63fa2
ws connect has a new option to send HTTP headers + use WebSocketHttpHeaders instead of unordered_map<string, string>
2019-08-26 10:19:09 -07:00
ozychhi
93debc00dc
Add client handshake extra headers ( #105 )
...
Even though 6455 defines all the necessary headers needed for
client/server handshake, in practice most of the cases websocket servers
expect few more headers. Therefore adding this functionality.
2019-08-26 09:37:40 -07:00
Benjamin Sergeant
3e15840b14
- WebSocket::send() sends message in TEXT mode by default
...
- WebSocketMessage sets a new binary field, which tells whether the received incoming message is binary or text
2019-06-09 11:56:47 -07:00
Benjamin Sergeant
0d147cbd94
WebSocket::send takes a third arg, binary which default to true (can be text too)
2019-06-09 11:35:31 -07:00
Benjamin Sergeant
be93f7480a
WebSocket callback only take one object, a const ix::WebSocketMessagePtr& msg
2019-06-09 11:33:17 -07:00
Benjamin Sergeant
2e5f24f1f8
...
2019-06-09 10:22:27 -07:00
Benjamin Sergeant
076e8bf6a3
add an option to easily disable per message deflate compression
2019-06-06 13:48:53 -07:00
Benjamin Sergeant
879a4b38aa
std::chrono::duration is not initialized to 0 units of time
2019-05-26 14:16:15 -07:00
Kumamon38
8a4826164b
fix close bug and tests : let poll do his job when closing ( #79 )
...
* let poll do his job when closing
* try fix test
* try fix test
* Update IXWebSocketTransport.cpp
* add log to find issue on CI
* add log to find issue on CI
* add log to find issue on CI
* add log to find issue on CI
* add log to find issue on CI
* change state immediately, and send close frame after
* add immediate close test
* disable test for windows
2019-05-21 09:34:08 -07:00
Benjamin Sergeant
243f41bf28
use a regular mutex instead of a recursive one + stop properly
2019-05-15 19:26:02 -07:00
Benjamin Sergeant
12fe55905c
enum class HttpErrorCode derives from int
2019-05-15 16:50:00 -07:00
Benjamin Sergeant
7f1e70329c
close and stop with code and reason + docker = ubuntu xenial
2019-05-15 15:18:46 -07:00
Dimon4eg
186c8fbb62
add isEnabledAutomaticReconnection ( #75 )
...
* add isEnabledAutomaticReconnection
* test isEnabledAutomaticReconnection
* rename
2019-05-14 11:26:37 -07:00
Dimon4eg
be2aee3354
fix for Windows ( #69 )
...
* fix for Windows
* fix condition
* make condition only on Windows
2019-05-12 22:21:56 -07:00
Dimon4eg
99a3bbc4f9
use C++11 enums ( #67 )
...
* use C++11 enums
* small rename
* update tests
* update tests
* update ws
* update ws
* update README.md
2019-05-11 14:22:06 -07:00
Dimon4eg
2254421ead
minor improvements ( #66 )
...
* minor improvements
* fix build
* improve tests code
2019-05-11 12:20:58 -07:00
Benjamin Sergeant
4934f5846b
minor tweaks to have full feature parity before unittest broke
2019-05-11 11:54:21 -07:00
Benjamin Sergeant
c8c1aabf20
fix race condition in SelectInteruptPipe, where _fildes are not protected (caught by fedora tsan)
2019-05-11 11:45:26 -07:00