Skip to main content

Server to cliet messenger, for notifying clients in a client-server models

Project description

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 
messager = SCMessenger(server_url)

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

# login
messenger.login("username1","password1")
  • connecting client two
from s2cm.client import SCMessenger

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

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

# login
messenger.login("username2","password2")

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

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>

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

s2cm-0.3.0-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file s2cm-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: s2cm-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for s2cm-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af1493aabdd2e5294cea04311232af79230463dd268bb2726f024d7252dc399a
MD5 8a3c6f0798bc085b2db3717098d6a2f1
BLAKE2b-256 63d0612e681fe8f44d365b1df37a0a714ae369abab37a71b9ee86d2ef769857c

See more details on using hashes here.

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