Coder Social home page Coder Social logo

usamawizard / django-websockets-no-dep Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lautaronavarro/django-websockets-no-dep

0.0 0.0 0.0 9 KB

Django 3.0 with ASGI + web-sockets implementation with no dep

Dockerfile 3.80% Python 96.20%

django-websockets-no-dep's Introduction

django-websockets-no-dep

Django 3.0 with ASGI + web-sockets implementation with no dep

Trying it out

Prerequisite

You need to have installed in your system docker + docker-compose

Running the project

First build the images, this can take some time based on your Mbps

docker-compose build

Then start the containers

docker-compose up

Now you will be able to access to your localhost on port 8000

Testing it

Firts let's create a websocket connection, open your browser and in the console run

ws = new WebSocket('ws://localhost:8000/')

Then set a on message function

ws.onmessage = event => console.log(event.data)

Now from a http client (postman, curl, browser, etc) hit the endpoint GET http://localhost:8000/trigger_event/

You will get a json response {"status": "ok"}

Now take a look at the console, you should see a console log Event triggered

django-websockets-no-dep's People

Contributors

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