Commit Graph

55 Commits

Author SHA1 Message Date
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
Benjamin Sergeant
518a445074 rename some variables, minor cleanup 2019-05-11 10:24:28 -07:00
dimon4eg
d49b1bd78a fix crash on close 2019-05-11 10:15:22 -07:00
Dimon4eg
bd96050d84 fix crash on close 2019-05-11 10:12:33 -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
Dimon4eg
3df142db7a Improve calculateRetryWaitMilliseconds (#63)
* improve calculateRetryWaitMilliseconds

* update comment
2019-05-10 12:31:21 -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
16e5b08a0f Remove redundant iostream includes (#60) 2019-05-08 13:33:21 -07:00
Benjamin Sergeant
28a7ec4f35 doc: add reference to the conan file built at https://github.com/Zinnion/conan-IXWebSocket 2019-05-01 21:31:32 -07:00
Benjamin Sergeant
b5aae88a0b remove un-needed _backgroundThreadRunning variable 2019-05-01 11:09:25 -07:00
Benjamin Sergeant
bee97237d9 Make AutomaticReconnection optional (#47)
* unittest pass + commands behave as expected

* cleanup
2019-04-29 21:12:34 -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
Benjamin Sergeant
f6ae490723 Fix data race in WebSocket where _url is accessed without protection in setThreadName
Also fix with url usage + docker container uses fedora and works with tsan
2019-04-25 16:11:46 -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
Kumamon38
c3431f19bf Real ping (#32)
* close method change and fix code

* missing mutex

* wip

* renaming and fixes

* renaming, fixes

* added enablePong/disablePong, add tests

* added new test cases

* add 1 test case

* fix gcd name to greatestCommonDivisor

* move ping and ping timeout checks into socket poll, local var in test cases and indent fixes

* indent issue
2019-04-18 09:24:16 -07:00
Benjamin Sergeant
f029321664 can send TEXT message (we only support BINARY messages now) 2019-03-22 14:24:22 -07:00
Michael Lu
663299c91e Fixed heartbeat typos (#22) 2019-03-19 21:31:43 -07:00
Benjamin Sergeant
08c2cdbf1d send can fail silently when sending would block (EWOULDBLOCK return for send) (#18)
* try to use a pipe for communication

* flush send buffer on the background thread

* cleanup

* linux fix / linux still use event fd for now

* cleanup
2019-03-13 23:09:45 -07:00
Benjamin Sergeant
d88bf16500 add new message type when receiving message fragments 2019-03-11 11:12:43 -07:00
Benjamin Sergeant
932bb732e0 Feature/send large message (#14)
* introduce send fragment

* can pass a fin frame

* can send messages which are a perfect multiple of the chunk size

* set fin only for last fragment

* cleanup

* last fragment should be of type CONTINUATION

* Add simple send and receive programs

* speedups receiving + better way to wait for thing

* receive speedup by using linked list of chunks instead of large array

* document bug

* use chunks to receive data

* trailing spaces
2019-02-20 18:59:07 -08:00
Benjamin Sergeant
a8b6573f96 hearbeat 2019-01-24 12:42:49 -08:00
Benjamin Sergeant
89ff9dd5ac fix gcc warning 2019-01-05 16:26:11 -08:00
Benjamin Sergeant
bce5ef2dca timeout is configurable 2019-01-03 18:33:08 -08:00
Benjamin Sergeant
bd1c8873d0 capture path/uri when connecting, and pass it back through callbacks in the openInfo member 2019-01-03 17:44:10 -08:00
Benjamin Sergeant
64f649d1f9 split handshake code into its own files, so that Transport file is less massive 2019-01-02 20:07:54 -08:00
Benjamin Sergeant
1bc5bc7f1c add a way to run in blocking more, which is useful for server mode to have N*thread instead of 2N*thread for N connections 2019-01-01 21:25:15 -08:00
Benjamin Sergeant
3443e82812 more cleanup to propagate server connection error and let onOpen callback execute 2018-12-31 12:43:47 -08:00
Benjamin Sergeant
379a845166 cleanup / use a websocket instead of raw websockettransport 2018-12-30 22:00:49 -08:00
Benjamin Sergeant
a79f4c10a1 set thread name / rename example 2018-12-23 14:14:38 -08:00
Benjamin Sergeant
49bf8bd830 threading race condition fixes, detected by TSAN 2018-12-06 08:27:28 -08:00
Benjamin Sergeant
c64bc20bb5 cleanup 2018-11-14 15:52:28 -08:00