Giter Site home page Giter Site logo

demowebsocket-server's Introduction

Demo Websocket Server (proof of concept)

Arch overview

Arch Oveview

Describe main processes

Send message

Send message

Subscribe to channel

Subscribe to channel

Avalible websocket request (for client)

Action Example message in json
subscribe to the channel room1 { "type": "SUBSCRIBE", "payload": "room1"}
unsubscribe from the channel room1 { "type": "UNSUBSCRIBE", "payload": "room1"}
answer on ping message { "type": "PONG", "payload": "PONG"}

Avalible websocket response (for client)

Action Example message in json
Subscribe result { "type": "RESPONSE_SUBSCRIBE", "payload": "SUBSCRIBE_OK(room1)", code: 200}
Subscribe result (access denied) { "type": "RESPONSE_SUBSCRIBE", "payload": "SUBSCRIBE_ACCESS_DENIED(room1)", code: 403}
Unsubscrube result { "type": "RESPONSE_UNSUBSCRIBE", "payload": "UNSUBSCRIBE_OK(room1)", code: 200}
Receiving data { "type": "DATA", "payload": "message text or json", code: 200}
Disconnect { "type": "DISCONNECT", "payload": "DISCONNECT", code: 200}
Ping (check connection, you should answer PONG) { "type": "PING", "payload": "PING", code: 200}

Build and try

Start redis

docker-compose up -d

Start demo_ws_push_executor (port 8001)

./gradlew :demo_ws_push_executor:bootRun

Start demo_ws_public_executor (port 8000)

./gradlew :demo_ws_public_executor:bootRun

Start demo push client for send message

run net/alfss/demowsclient/DemoPushClientMain.kt

Start demo websocket client

run net/alfss/demowsclient/DemoWsClientMain.kt

demowebsocket-server's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.