Since factory returns a ProxyConnectionState, setOnConnectionCallback
will be a ProxyConnectionState. The code already makes that assumption,
since it does not check of state return value. Using a
static_pointer_cast will allow the library to be build with rtti.
This might happen in some special cases where
WebSocketTransport::sendOnSocket() fails, closes the socket, and set
the ready state to CLOSED, but WebSocket::run() stills wait the
interrupt event to happen.
Possibly related to #474
* 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@>
* Fix memory leak with shared_ptr and -fsanitize=address
* Replace addrinfo* by shared_ptr
* fsanitize=address only on Linux
* Add USE_WS Linux CI test
* Remove fsanitize from the cmake files
* Remove USE_WS in linux test suite
* 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>
The generated header only "looked like" Base64, but if the other side
actually tried to decode it as such, it could fail. This change fixes
that to always generate a valid Base64 value.
The Base64 code is copied from
https://gist.github.com/tomykaira/f0fd86b6c73063283afe550bc5d77594.
* Update IXSocket.h
Avoid "conflicting declaration 'typedef SSIZE_T ssize_t'"
* Update IXUdpSocket.h
* Update IXNetSystem.cpp
ENOSPC and EAFNOSUPPORT are not defined for clang on windows
This change adds onChunkCallback to the request. If defined it will be
called repeatedly with the incoming data. This allows to process data on
the go or write it to disk instead of accumulating the data in memory.
* 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
* mbedls system certs
* missing curly brace ...
* windows uwp for appveyor
* try again uwp
* update version and changelog
* revert odd change in test/IXSocketTest.cpp
Co-authored-by: Benjamin Sergeant <bsergeant@mz.com>
* Fix#323: Missing SelectInterrupt implementation for Windows
Using WSAEventSelect, WSAWaitForMultipleEvents and WSAEnumNetworkEvents to emulate poll() with an interrupt-event.
* Cleanup
* Fixed incomplete comment.
* Switched ifdefs to support other Unixes with pipe file descriptors
* Fixed: SelectInterrupt fallback code for getFd()==-1 && getEvent()==nullptr converted a PollResultType::Timeout into a ReadyForRead causing the HttpClient to fail because it uses a hard-coded "SelectInterrupt" instance that doesn't implement getFd() and getEvent().
* Fixed gcc compile errors
* - HttpClient now uses the SelectInterruptFactory
- Fixed wrong ix::poll result when using Windows WSA functions
* We must deselect the networkevents from the socket event. Otherwise the socket will report states that aren't there.
See https://en.cppreference.com/w/cpp/header/cerrno for additional details. Some of used constants are defined in this header.
Inclusion is necessary to avoid these errors:
```
/home/user/IXWebSocket/ixwebsocket/IXNetSystem.cpp:189:30: error: use of undeclared identifier 'EAFNOSUPPORT'
default: errno = EAFNOSUPPORT; return 0;
^
/home/user/IXWebSocket/ixwebsocket/IXNetSystem.cpp:191:17: error: use of undeclared identifier 'ENOSPC'
errno = ENOSPC;
^
/home/user/IXWebSocket/ixwebsocket/IXNetSystem.cpp:175:25: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long long') to 'int' [-Wshorten-64-to-32]
j = strspn(buf + i, ":0");
~ ^~~~~~~~~~~~~~~~~~~~~
/home/user/IXWebSocket/ixwebsocket/IXNetSystem.cpp:234:21: error: use of undeclared identifier 'EAFNOSUPPORT'
errno = EAFNOSUPPORT;
^
2 warnings and 3 errors generated.
```
* mbedls system certs
* missing curly brace ...
* windows uwp for appveyor
* try again uwp
* bump version
* keep using local cacert.pem in unittest
* appveyor back to normal
* remove appveyor file
Co-authored-by: Benjamin Sergeant <bsergeant@mz.com>
* Correctly convert remote port bytecode to uint16 port number.
Copied the network_to_host_short function from the ASIO library to convert the remote port byte code to a uint16 number.
* Switched from uint16_t to unsigned short to work in Windows
* Updated missed uint16_t to unsigned short