Compare commits
8 Commits
release/5.
...
v5.0.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c77d6ae3f5 | ||
|
|
c72b2dbd6b | ||
|
|
835523f77b | ||
|
|
ec8a35b587 | ||
|
|
aca18995d1 | ||
|
|
f9178f58aa | ||
|
|
2477946e68 | ||
|
|
7c4d040384 |
20
.travis.yml
20
.travis.yml
@@ -15,15 +15,17 @@ matrix:
|
||||
- python test/run.py
|
||||
- make ws
|
||||
|
||||
# # Linux
|
||||
# - os: linux
|
||||
# dist: xenial
|
||||
# script:
|
||||
# - python test/run.py
|
||||
# - make ws
|
||||
# env:
|
||||
# - CC=gcc
|
||||
# - CXX=g++
|
||||
# Linux
|
||||
- os: linux
|
||||
dist: bionic
|
||||
before_install:
|
||||
- sudo apt-get install -y libmbedtls-dev
|
||||
script:
|
||||
- python test/run.py
|
||||
- make ws
|
||||
env:
|
||||
- CC=gcc
|
||||
- CXX=g++
|
||||
|
||||
# Clang + Linux disabled for now
|
||||
# - os: linux
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [5.0.4] - 2019-08-20
|
||||
- Windows build fixes (there was a problem with the use of ::poll that has a different name on Windows (WSAPoll))
|
||||
|
||||
## [5.0.3] - 2019-08-14
|
||||
- CobraMetricThreadedPublisher _enable flag is an atomic, and CobraMetricsPublisher is enabled by default
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
5.0.3
|
||||
5.0.4
|
||||
|
||||
33
README.md
33
README.md
@@ -16,9 +16,32 @@
|
||||
|
||||
The [*ws*](https://github.com/machinezone/IXWebSocket/tree/master/ws) folder countains many interactive programs for chat, [file transfers](https://github.com/machinezone/IXWebSocket/blob/master/ws/ws_send.cpp), [curl like](https://github.com/machinezone/IXWebSocket/blob/master/ws/ws_http_client.cpp) http clients, demonstrating client and server usage.
|
||||
|
||||
### Windows note
|
||||
|
||||
To use the network system on Windows, you need to initialize it once with *WSAStartup()* and clean it up with *WSACleanup()*. We have helpers for that which you can use, see below. This init would typically take place in your main function.
|
||||
|
||||
```
|
||||
#include <ixwebsocket/IXNetSystem.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
ix::initNetSystem();
|
||||
|
||||
...
|
||||
|
||||
ix::uninitNetSystem();
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
### WebSocket client API
|
||||
|
||||
```
|
||||
#include <ixwebsocket/IXWebSocket.h>
|
||||
|
||||
...
|
||||
|
||||
# Our websocket object
|
||||
ix::WebSocket webSocket;
|
||||
|
||||
std::string url("ws://localhost:8080/");
|
||||
@@ -59,6 +82,10 @@ webSocket.stop()
|
||||
### WebSocket server API
|
||||
|
||||
```
|
||||
#include <ixwebsocket/IXWebSocketServer.h>
|
||||
|
||||
...
|
||||
|
||||
// Run a server on localhost at a given port.
|
||||
// Bound host name, max connections and listen backlog can also be passed in as parameters.
|
||||
ix::WebSocketServer server(port);
|
||||
@@ -120,6 +147,10 @@ server.wait();
|
||||
### HTTP client API
|
||||
|
||||
```
|
||||
#include <ixwebsocket/IXHttpClient.h>
|
||||
|
||||
...
|
||||
|
||||
//
|
||||
// Preparation
|
||||
//
|
||||
@@ -199,6 +230,8 @@ bool ok = httpClient.performRequest(args, [](const HttpResponsePtr& response)
|
||||
### HTTP server API
|
||||
|
||||
```
|
||||
#include <ixwebsocket/IXHttpServer.h>
|
||||
|
||||
ix::HttpServer server(port, hostname);
|
||||
|
||||
auto res = server.listen();
|
||||
|
||||
@@ -12,6 +12,12 @@
|
||||
#include <basetsd.h>
|
||||
#include <io.h>
|
||||
#include <ws2def.h>
|
||||
|
||||
static inline int poll(struct pollfd *pfd, unsigned long nfds, int timeout)
|
||||
{
|
||||
return WSAPoll(pfd, nfds, timeout);
|
||||
}
|
||||
|
||||
#else
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
@@ -22,6 +28,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <poll.h>
|
||||
#endif
|
||||
|
||||
namespace ix
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <stdint.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user