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.1a0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file s2cm-0.3.1a0-py3-none-any.whl.

File metadata

  • Download URL: s2cm-0.3.1a0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 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.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 886a9b05bf8125e71eb41180f97dd8f03349677ffc42b29b85e67cbe0e66c3f6
MD5 ada70cc72b68d1ec349481678c31b823
BLAKE2b-256 0a44482bd725eeab200967f1af0fdc99f6037ce2559faadb4261a0ce459e33dd

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