Compare commits

...

8 Commits

Author SHA1 Message Date
Benjamin Sergeant
c77d6ae3f5 bump version + talk about Windows fix in the changelog 2019-08-20 09:20:02 -07:00
Benjamin Sergeant
c72b2dbd6b add poll alias to WSAPoll on Windows 2019-08-19 22:26:25 -07:00
Benjamin Sergeant
835523f77b fix #101 / wrong include in IXSocket.cpp on Windows 2019-08-19 22:19:39 -07:00
Benjamin Sergeant
ec8a35b587 README tweaks 2019-08-19 20:35:26 -07:00
Benjamin Sergeant
aca18995d1 README / formatting 2019-08-19 20:33:56 -07:00
Benjamin Sergeant
f9178f58aa README.md: add reference to WSAStartup to initialize the networking system 2019-08-19 09:47:59 -07:00
Benjamin Sergeant
2477946e68 (CI) linux: install libmbedtls 2019-08-14 21:49:43 -07:00
Benjamin Sergeant
7c4d040384 (CI) try to build Linux on Ubuntu Bionic 2019-08-14 21:44:49 -07:00
6 changed files with 55 additions and 11 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -1 +1 @@
5.0.3
5.0.4

View File

@@ -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();

View File

@@ -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

View File

@@ -17,7 +17,6 @@
#include <stdint.h>
#include <fcntl.h>
#include <sys/types.h>
#include <poll.h>
#include <algorithm>