mirror of
https://github.com/socketio/socket.io-client-cpp.git
synced 2026-06-11 04:52:42 +00:00
update readme
This commit is contained in:
parent
e40c6b0b97
commit
108d8b2af5
32
README.md
32
README.md
@ -15,12 +15,20 @@ By virtue of being written in C++, this client works in several different platfo
|
|||||||
- Similar API to the Socket.IO JS client
|
- Similar API to the Socket.IO JS client
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
### With CMake
|
||||||
1. Install boost
|
1. Install boost, see [Boost setup](#boost_setup) section.
|
||||||
2. Use `git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git` to clone your local repo.
|
2. Use `git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git` to clone your local repo.
|
||||||
3. Include `websocket++`, `rapidjson` and `sio_client.cpp`,`sio_packet.cpp`,`sio_socket.cpp`,`internal/sio_client_impl.cpp` in your project.
|
3. Run `cmake -DBOOST_PATH:STRING=<your boost install folder> ./
|
||||||
4. Include `sio_client.h` where you want to use it.
|
4. Run `make`(if makefile generated) or open generated project (if project file generated) to build.
|
||||||
5. Use `message` and its derived classes to compose complex text/binary messages.
|
5. Include `sio_client.h` in your client code where you want to use it.
|
||||||
|
|
||||||
|
### Without CMake
|
||||||
|
1. Install boost, see [Boost setup](#boost_setup) section.
|
||||||
|
2. Use `git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git` to clone your local repo.
|
||||||
|
3. Add `<your boost install folder>/include`,`./lib/websocketpp` and `./lib/rapidjson/include` to headers search path.
|
||||||
|
4. Include all files under `./src` in your project, add `sio_packet.cpp`,`sio_socket.cpp`,`internal/sio_client_impl.cpp` to source list.
|
||||||
|
5. Add `<your boost install folder>/lib` to library search path, add `boost.lib`(Win32) or `-lboost`(Other) link option.
|
||||||
|
6. Include `sio_client.h` in your client code where you want to use it.
|
||||||
|
|
||||||
## API
|
## API
|
||||||
### *Overview*
|
### *Overview*
|
||||||
@ -216,7 +224,7 @@ Get socket.io session id.
|
|||||||
|
|
||||||
All designated constructor of `message` objects is hidden, you need to create message and get the `message::ptr` by `[derived]_message:create()`.
|
All designated constructor of `message` objects is hidden, you need to create message and get the `message::ptr` by `[derived]_message:create()`.
|
||||||
|
|
||||||
## Boost setup
|
##<a name="boost_setup"></a> Boost setup
|
||||||
* Download boost from [boost.org](http://www.boost.org/).
|
* Download boost from [boost.org](http://www.boost.org/).
|
||||||
|
|
||||||
* Unpack boost to some place.
|
* Unpack boost to some place.
|
||||||
@ -225,22 +233,24 @@ All designated constructor of `message` objects is hidden, you need to create me
|
|||||||
|
|
||||||
## Boost build (Build the necessary subset only)
|
## Boost build (Build the necessary subset only)
|
||||||
|
|
||||||
#### Windows:
|
#### Windows (or other mainstream desktop platforms shall work too):
|
||||||
Run with following script will build the necessary subset:
|
Run with following script will build the necessary subset:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bjam stage --toolset=msvc --with-system --with-date_time --with-random --stagedir="release" link=static runtime-link=shared threading=multi release
|
bjam install --prefix="<your boost install folder>" --with-system --with-date_time --with-random link=static runtime-link=shared threading=multi
|
||||||
```
|
```
|
||||||
Optionally You can merge all output .lib files into a fat one, in output folder, run:
|
Optionally You can merge all output .lib files into a fat one,especially if you're not using cmake.
|
||||||
|
|
||||||
|
In output folder, run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
lib.exe /OUT:boost.lib *
|
lib.exe /OUT:boost.lib *
|
||||||
```
|
```
|
||||||
|
|
||||||
#### iOS and OSX
|
#### iOS
|
||||||
Use this [shell](https://github.com/socketio/socket.io-client-cpp/blob/master/examples/iOS/SioChatDemo/boost/boost.sh) to download and build boost completely automattically.
|
Use this [shell](https://github.com/socketio/socket.io-client-cpp/blob/master/examples/iOS/SioChatDemo/boost/boost.sh) to download and build boost completely automattically.
|
||||||
|
|
||||||
#### Add boost source folder to your `header search path`, and add static libs to link option.
|
It installs boost to `<shell folder>/prefix`.
|
||||||
|
|
||||||
##License
|
##License
|
||||||
BSD
|
BSD
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user