Skip to main content

A Rackio extension to add a SocketIO Server to Rackio

Project description

rackio-socket

A Rackio extension to add a SocketIO Server to Rackio

Installation

pip install RackioSocket

Usage

from rackio import Rackio
from rackio_socket import RackioSocket

app = Rackio()

RackioSocket(app, 5005)

app.run(8028)

SocketIO Client

After running your application it will serve the SocketIO through the 5005 port.

var socket = io('http://localhost:5005');

Adding new events to your applications

You can add your custom events using the decorator pattern.

rs = RackioSocket()

@rs.event
def custom(sid):
    print("custom event " , sid)
    rs.emit("response", {"message": "this is the custom response"})


@rs.on("another custom")
def another_event(sid, data):

    response = processing(data)

    rs.emit('response', response)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

RackioSocket-0.9.win-amd64.zip (20.7 kB view hashes)

Uploaded Source

Built Distribution

RackioSocket-0.9-py3-none-any.whl (7.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page