Git Product home page Git Product logo

rust-warp-websockets-example's Introduction

Example Websocket Server

Simple example showing how to implement a websocket server in Rust on top of Warp.

Why?

1st of all to see how it's done.

2nd - we needed something to simulate websockets server in order to write up the integration client, which will be generic, asyncio (python) client that is capable of managing many open connections to many different webservers. If you have a similar need and don't want to write up your own, feel free to use ours or contact us, we are more than happy to consult :)

Whats not included

PubSub is not included. If you're specifically looking for a pubsub example check out following links:

https://blog.logrocket.com/how-to-build-a-websocket-server-with-rust/ (code )

warp example

If you really would like to see how to setup pubsub in the context of this project, open an issue and we will be happy to add this.

URLs

  1. GET /health-check - pinging this endpoint will return ok message. Can be used to validate that the server is running.

  2. /ws - websocket endpoint with no authorization.

    • Expected payload {"kind": "some kind", "message": "some message"}.
    • Result returned {"status": "success", "response": "awesome message"}.
  3. /ws-private - websocket endpoint with api token authorization. Same payloads as in step 2.

    • Expected header 'Authorization: Token 6smtr8ke3s7yq63f3zug9z3th'

rust-warp-websockets-example's People

Contributors

altonotch 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.