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 

# 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>

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.2-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: s2cm-0.3.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bf59e326f9ce3b5a2f32d47db1747af0fd4d117591f159ed3193bfcf58d7665c
MD5 9cf30200402cc2951bc82b8ccca18d16
BLAKE2b-256 910cfb040200b9bc692f3a02c97ad5c842fae591ba89c9c1dd3475cb552ec711

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