Skip to content

This is an example to get user actions to control GPIO via webpage using Javascript.

Notifications You must be signed in to change notification settings

AI-Enola/WebSocket_Python_Server_JS_Client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebSocket_Python_Server_JS_Client

NEW VERSION COMING SOON

This is an example to get user actions to control GPIO via webpage using Javascript. WARNING : Do not content GPIO code.

In "client.js" file :

Line 13 - // NOTE : THIS SOCKET IS SET TO WORK WITH SSL USING WSS - IF NOT USING SSL THEN REPLACE WSS (WebSocket Secure) FOR WS (WebSocket) - IP and Port to match SERVER_INFO in server.py file.

Using SSL : const SOCKET = new WebSocket('wss://192.168.2.20:60004');

Without SSL : const SOCKET = new WebSocket('ws://192.168.2.20:60004');

In "server.py" file :

Line 179 - # SSL ACTIVATED BY DEFAULT - CAN BE CHANGED HERE - Also IP & PORT

 ws = WebsocketServer(IP="192.168.2.20", PORT=60004, USE_SSL=True) 

Line 119 - Call you own code to control GPIO or whatever you want.

 # GPIO CORE HERE

To start server.py :

  python3 server.py

About

This is an example to get user actions to control GPIO via webpage using Javascript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published