Skip to main content

s2cm

Dependabot Updates

logo

Server to client messenger for notifying users in a client server model

Installation

you can install latest stable via pip

pip install s2cm

For latest release, you can install from github

git clone https://github.com/Austin-rgb/s2cm.git
cd s2cm
pip install .

Usage

start the server

from s2cm.server import socketio, app
socketio.run(app,port=5000)

connect from client

For demonstration we connect 2 python clients

  • connecting client one
from s2cm.client import SCMessenger

server_url = "http://localhost:5000" # replace with the address of your server 

# register
SCMessenger.register("username1","password1")

# login
messenger = SCMessenger(server_url, username="username1",password="password1")

# Message user2
messenger.send("username2", "hi")
  • connecting client two
from s2cm.client import SCMessenger

server_url = "http://localhost:5000" # replace with the address of your server 

# register
SCMessenger.register("username2","password2")

# login
messenger = SCMessenger(server_url, username="username2",password="password2")

# once client 1 is connected client 2 can message her
messenger.send("username1","hi too")

Usage in javascript (web page)

s2cm can be accessed with javascript in a web page Once your server is running

<script src="http://localhost:5000/static/s2cm.client.min.js"></script>
<script>
const client=s2cm_client("http://localhost:5000")
client.emit("register",{"username":"username1","password":"password1"}
client.emit("login",{"username":"username1","password":"password1"}
client.emit("message_user",{"username":"username2","message":"Hi there"}) 
</script>

Metadata

Release files for s2cm 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for s2cm 0.3.2
File Interpreter ABI Platform
s2cm-0.3.2-py3-none-any.whl Python 3 none any Details

Release files / s2cm-0.3.2-py3-none-any.whl

Download URL s2cm-0.3.2-py3-none-any.whl
Size 17.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf59e326f9ce3b5a2f32d47db1747af0fd4d117591f159ed3193bfcf58d7665c
BLAKE2b-256 checksum
How to use checksums
910cfb040200b9bc692f3a02c97ad5c842fae591ba89c9c1dd3475cb552ec711
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.3.2 This release

1 release file

0.3.0

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page