update README
This commit is contained in:
parent
788c92487c
commit
7e45659377
17
README.md
17
README.md
@ -10,7 +10,7 @@ communication channels over a single TCP connection. *IXWebSocket* is a C++ libr
|
|||||||
* macOS
|
* macOS
|
||||||
* iOS
|
* iOS
|
||||||
* Linux
|
* Linux
|
||||||
* Android
|
* Android
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
@ -63,10 +63,11 @@ Here is what the server API looks like. Note that server support is very recent
|
|||||||
ix::WebSocketServer server(port);
|
ix::WebSocketServer server(port);
|
||||||
|
|
||||||
server.setOnConnectionCallback(
|
server.setOnConnectionCallback(
|
||||||
[&server](std::shared_ptr<ix::WebSocket> webSocket)
|
[&server](std::shared_ptr<WebSocket> webSocket,
|
||||||
|
std::shared_ptr<ConnectionState> connectionState)
|
||||||
{
|
{
|
||||||
webSocket->setOnMessageCallback(
|
webSocket->setOnMessageCallback(
|
||||||
[webSocket, &server](ix::WebSocketMessageType messageType,
|
[webSocket, connectionState, &server](ix::WebSocketMessageType messageType,
|
||||||
const std::string& str,
|
const std::string& str,
|
||||||
size_t wireSize,
|
size_t wireSize,
|
||||||
const ix::WebSocketErrorInfo& error,
|
const ix::WebSocketErrorInfo& error,
|
||||||
@ -77,6 +78,12 @@ server.setOnConnectionCallback(
|
|||||||
{
|
{
|
||||||
std::cerr << "New connection" << std::endl;
|
std::cerr << "New connection" << std::endl;
|
||||||
|
|
||||||
|
// A connection state object is available, and has a default id
|
||||||
|
// You can subclass ConnectionState and pass an alternate factory
|
||||||
|
// to override it. It is useful if you want to store custom
|
||||||
|
// attributes per connection (authenticated bool flag, attributes, etc...)
|
||||||
|
std::cerr << "id: " << connectionState->getId() << std::endl;
|
||||||
|
|
||||||
// The uri the client did connect to.
|
// The uri the client did connect to.
|
||||||
std::cerr << "Uri: " << openInfo.uri << std::endl;
|
std::cerr << "Uri: " << openInfo.uri << std::endl;
|
||||||
|
|
||||||
@ -223,13 +230,13 @@ Here is a simplistic diagram which explains how the code is structured in term o
|
|||||||
+-----------------------+ --- Public
|
+-----------------------+ --- Public
|
||||||
| | Start the receiving Background thread. Auto reconnection. Simple websocket Ping.
|
| | Start the receiving Background thread. Auto reconnection. Simple websocket Ping.
|
||||||
| IXWebSocket | Interface used by C++ test clients. No IX dependencies.
|
| IXWebSocket | Interface used by C++ test clients. No IX dependencies.
|
||||||
| |
|
| |
|
||||||
+-----------------------+
|
+-----------------------+
|
||||||
| |
|
| |
|
||||||
| IXWebSocketServer | Run a server and give each connections its own WebSocket object.
|
| IXWebSocketServer | Run a server and give each connections its own WebSocket object.
|
||||||
| | Each connection is handled in a new OS thread.
|
| | Each connection is handled in a new OS thread.
|
||||||
| |
|
| |
|
||||||
+-----------------------+ --- Private
|
+-----------------------+ --- Private
|
||||||
| |
|
| |
|
||||||
| IXWebSocketTransport | Low level websocket code, framing, managing raw socket. Adapted from easywsclient.
|
| IXWebSocketTransport | Low level websocket code, framing, managing raw socket. Adapted from easywsclient.
|
||||||
| |
|
| |
|
||||||
|
1
third_party/remote_trailing_whitespaces.sh
vendored
1
third_party/remote_trailing_whitespaces.sh
vendored
@ -1,2 +1,3 @@
|
|||||||
find . -type f -name '*.cpp' -exec sed -i '' 's/[[:space:]]*$//' {} \+
|
find . -type f -name '*.cpp' -exec sed -i '' 's/[[:space:]]*$//' {} \+
|
||||||
find . -type f -name '*.h' -exec sed -i '' 's/[[:space:]]*$//' {} \+
|
find . -type f -name '*.h' -exec sed -i '' 's/[[:space:]]*$//' {} \+
|
||||||
|
find . -type f -name '*.md' -exec sed -i '' 's/[[:space:]]*$//' {} \+
|
||||||
|
@ -29,7 +29,7 @@ Subcommands:
|
|||||||
ws transfer # running on port 8080.
|
ws transfer # running on port 8080.
|
||||||
|
|
||||||
# Start receiver first
|
# Start receiver first
|
||||||
ws receive ws://localhost:8080
|
ws receive ws://localhost:8080
|
||||||
|
|
||||||
# Then send a file. File will be received and written to disk by the receiver process
|
# Then send a file. File will be received and written to disk by the receiver process
|
||||||
ws send ws://localhost:8080 /file/to/path
|
ws send ws://localhost:8080 /file/to/path
|
||||||
|
Loading…
x
Reference in New Issue
Block a user