iris/_examples/websocket/basic
Gerasimos (Makis) Maropoulos 33028f900d update the nantive-messages(only) example to the latest websocket (minimum changes, the idea is the same) and misc
Former-commit-id: 9598319bc13e8a383114c37f4da84f337ab47b22
2019-06-25 22:10:10 +03:00
..
browser update the nantive-messages(only) example to the latest websocket (minimum changes, the idea is the same) and misc 2019-06-25 22:10:10 +03:00
browserify _examples/websocket/basic: add a nodejs client and provide a README.md on how to run the websocket clients and the server 2019-06-13 12:15:01 +03:00
go-client add more websocket helpers from neffos project 2019-06-15 14:07:35 +03:00
nodejs-client _examples/websocket/basic: add a nodejs client and provide a README.md on how to run the websocket clients and the server 2019-06-13 12:15:01 +03:00
overview.png _examples/websocket/basic: add a nodejs client and provide a README.md on how to run the websocket clients and the server 2019-06-13 12:15:01 +03:00
README.md _examples/websocket/basic: add a nodejs client and provide a README.md on how to run the websocket clients and the server 2019-06-13 12:15:01 +03:00
server.go create the new FileServer and HandleDir, deprecate the rest APIBuilder/Party static methods and more 2019-06-21 19:43:25 +03:00

Basic Example

At the end of this example you will be able to run a websocket server and clients for all platforms (Go, Browser and Nodejs).

Open as many clients as you want to try out and start typing.

This example contains only the basics, however, the library supports rooms, native websocket messages, any data can be sent and received (i.e protobufs, json) and all kinds of broadcasting and connections collections.

How to run

Server

Open a terminal window instance and execute:

$ go run server.go # start the websocket server.

Client (Go)

Start a new terminal instance and execute:

$ cd ./go-client
$ go run client.go # start the websocket client.
# start typing...

Client (Browser)

Navigate to http://localhost:8080 and start typing. The ./browser/index.html should be served, it contains the client-side code.

Client (Browserify)

Install NPM first, then start a new terminal instance and execute:

$ cd ./browserify
$ npm install
# build the modern browser-side client:
# embed the neffos.js node-module and app.js
# into a single ./browserify/bundle.js file
# which ./browserify/client.html imports.
$ npm run-script build

Navigate to http://localhost:8080/browserify/client.html and start typing.

Client (Nodejs)

Install NPM if you haven't already and then, start a new terminal instance and execute:

$ cd nodejs-client
$ npm install
$ node client.js # start the websocket client.
# start typing.