Azamat H. Hackimov
9157873f5b
Fix compilation on GCC-13 ( #443 )
...
* Fix compilation on GCC-13
GCC-13 changes internal cstdint includes, and now files that uses
standart integer types should directly include cstdint header.
See: https://gcc.gnu.org/gcc-13/porting_to.html#header-dep-changes
Bug: https://bugs.gentoo.org/865117
Bug: https://bugs.gentoo.org/895440
* Convert line endings to Unix format
2023-02-25 13:50:35 -08:00
YuHuanTin
aa2ca19895
Added support for setting custom ping messages with support for any 'ping' message type (binary ping message, text ping message) ( #438 )
...
* Added support for setting custom ping messages with support for any 'ping' message type (binary ping message, text ping message)
* Add default value
---------
Co-authored-by: YuHuanTin <2@>
2023-02-23 08:29:07 -08:00
TheArtfulBodger
b0fd119d14
Host HTTP and WS on the same port ( #414 )
...
* Quick hack to host HTTP and WS on the same port #373
* Quick hack to host HTTP and WS on the same port #373 - simplify code
* ran clang-format
Co-authored-by: En Shih <seanstone5923@gmail.com>
Co-authored-by: The Artful Bodger <TheArtfulBodger@users.noreply.github.com>
2022-11-05 18:53:11 -07:00
Andreas Hausladen
b5cf33a582
Introduction of IXWebSocketSendData ( #347 )
...
* Introduction of IXWebSocketSendData that makes it possible to not only send std::string but also std::vector<char/uint8_t> and char* without copying them to a std::string first.
Add a sendUtf8Text() method that doesn't check for invalid UTF-8 characters. The caller must guarantee that the string only contains valid UTF-8 characters.
* Updated usage.md: sendUtf8Text() and IXWebSocketSendData
2022-01-10 10:34:24 -08: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
Benjamin Sergeant
b6234ff908
compile errors due to missing changes for the introduction of setMinWaitBetweenReconnectionRetries and getMinWaitBetweenReconnectionRetries
2021-03-23 08:28:40 -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
Benjamin Sergeant
7c195219cd
reorder methods in IXWebSocket.h
2021-03-07 19:25:53 -08:00
Duncan Ogilvie
d739662a7c
Allow customizing the websocket handshake timeout ( #264 )
2021-03-07 19:23:43 -08: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
179e17895d
unique_ptr for sockets
2020-03-24 12:48:55 -07:00
Benjamin Sergeant
b287730c19
Simplify ping/pong based heartbeat implementation
2020-03-18 01:14:08 -07:00
Benjamin Sergeant
6d0c568aaa
update doc / fix incorrect comment about sending defaultint to binary mode
2020-02-24 16:24:32 -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
4c66a7561e
(WebSocketServer) add option to disable deflate compression, exposed with the -x option to ws echo_server
2020-02-18 21:38:28 -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
55141aa875
ws curl + http client tls option handling + ca cert processing for mbedtls
2019-09-29 21:13:11 -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
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
23cf4bd59b
Add explicite WebSocket::sendBinary
...
New headers + WebSocketMessage class to hold message data, still not used across the board
2019-06-09 10:10:33 -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
c65fec7271
clang format, based on cpprest
2019-05-30 08:46:50 -07:00
Benjamin Sergeant
51fa147b99
Revert "Merge branch 'Dimon4eg-message-queue'"
...
This reverts commit 13fa325134
, reversing
changes made to aecd5e9c94
.
2019-05-16 22:15:17 -07:00
Benjamin Sergeant
90d71deb0f
Add constants for closing code and messages
2019-05-16 19:23:32 -07:00
Benjamin Sergeant
ccaaedf38f
close and stop with code and reason + docker = ubuntu xenial
2019-05-16 19:23:32 -07:00
Dimon4eg
751f294164
add isEnabledAutomaticReconnection ( #75 )
...
* add isEnabledAutomaticReconnection
* test isEnabledAutomaticReconnection
* rename
2019-05-16 19:23:32 -07:00
dimon4eg
e846ca392f
update comment
2019-05-12 20:00:15 +03:00
dimon4eg
97617ced4a
Added WebSocketMessageQueue
2019-05-12 01:49:06 +03: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
518a445074
rename some variables, minor cleanup
2019-05-11 10:24:28 -07:00
Dimon4eg
2a90ad9e53
Fix crash during closing on Windows ( #64 )
...
* fix crash on close
* Improve calculateRetryWaitMilliseconds (#63 )
* improve calculateRetryWaitMilliseconds
* update comment
* cout -> spdlog
* fix crash on close
* uncomment test
* Revert "uncomment test"
This reverts commit 27df86ee8f
.
2019-05-11 09:51:26 -07:00
Kumamon38
1eb98cc74f
fix ping, fix send frame close ( #49 )
...
* fix ping, fix send frame close
* fixes for data race on _closeCode etc. and fix test
* fixing one TC
* fix waiting forever if no time to change of readyState, and poll never end
* add 1005 code if no status code received
* fixes for 1005 code
* fix test issue
* fix macOS issue
* revert to master tests and renaming
2019-05-09 09:21:05 -07:00
dimon4eg
2727d39fa4
update comments
2019-05-09 00:16:37 +03:00
Dimon4eg
45d40dc159
Added IXWebSocketPoll class
2019-05-08 22:02:56 +03:00
Benjamin Sergeant
b5aae88a0b
remove un-needed _backgroundThreadRunning variable
2019-05-01 11:09:25 -07:00
Benjamin Sergeant
e3444e666b
rename _blocking to _backgroundThreadRunning and invert the naming
2019-04-29 16:54:08 -07:00
Alexandre Konieczny
e37e69311b
fix data race on _thread
2019-04-29 16:46:16 -07:00
Kumamon38
28210ee31d
add boolean and add missing protocol error close constant ( #41 )
2019-04-23 04:31:55 -07:00
Benjamin Sergeant
7df7453365
indentation / comestic changes
2019-04-19 16:57:38 -07:00