Skip to main content

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

Project description

s2cm

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: s2cm-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 14.1 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.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f29e71ec913a3f6b31a5d65bd43c09c36b09f4696d78e8315c3ddf4302c0d9f3
MD5 b6bb46f0ac56ee29bab65a57831297cb
BLAKE2b-256 765cd8cb3b692d420460f3391fab62175d24e2b1566cd4705bf303e07b9d94ce

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