I'm building a home automation project, I have a websocket server I've built with pythons websocket and asyncio libraries. When I use a python client testing script and use local host to connect, it works perfectly. However, when I use my computers IPv4 address it doesn't. I've tried connecting using esp's, raspberry pi's and the same testing script on the same computer. Any idea's?
Related
Hello I tried a simple server and client script on my pc. It was working perfectly but when I tried to connect with pc server with my mobile it is not working I can't connect to pc server with my mobile client
Nothing works I tried changing ip not working I tried changing my laptop internet connection not working I tried using a third party app it says couldn't connect to host and my server script is completely fine
both devices will need to be on the same WLAN or Wifi Network.
you will also need to get your PC's network IP Address (eth0 or your main network card), then you will need your server to listen on ip 0.0.0.0 with the port you want to use.
Have a close look at your firewall and enabled outbound/inbound connnections for the port that you are using.
then you will need to put step 2's ip address as the server ip
then this should work
I'm trying to create a measurement device which can be controlled with a smart phone.
My situation
The places where I'm using the device don't have any internet connection available.
The measurement device uses a Raspberry PI, which creates a local WiFi network to communicate with the smart phone.
There is a Python webserver running on the RPI.
The smart phone has a PWA installed to send commands to the RPI's webserver.
The PWA is hosted on GitHub Pages (uses HTTPS by default).
After installation the PWA is supposed to work without an internet connection (just uses the RPI WiFi).
My goal is to successfully send requests to the Python webserver on the RPI by using the PWA on my smart phone.
My issue
When fetching the Python webserver within the PWA, I receive a Mixed Content error because the PWA is hosted on HTTPS (and also requires HTTPS) but the Python server is not.
When I tried using a self signed certificate created with OpenSSL, I receive a ERR_CERT_AUTHORITY_INVALID error.
I tried to use Let's Encrypt, but CertBot requires an actual domain. I only have an IP adress, which is the RPI's IP within its own WiFi network.
What should I do?
I fixed my issue by registering a free .tk domain pointing to 127.0.0.1 (localhost) and using Certbot from Let's Encrypt to create a SSL Certificate.
To validate the domain with Certbot I've used the TXT record validation.
In order to make use of the domain without an internet connection I've added a DNS record with the same .tk domain pointing to localhost inside the dnsmasq config file of the RPI.
My python webserver then uses the cert file to establish serving over HTTPS so the SPA on my mobile device won't throw an error when requesting data.
I have a problem where the socket client wont connect to the server in python when using ngrok. Only if i run the server before starting the client it works. Also the client wont detect when server looses connection anymore. I think the client detects ngrok as a server without the python server running
I'm trying to connect to an OPC Server using the python Open OPC library, it is working fine with a Matrikon OPC Simulator, however when I try to connect it to the actual server the client seems to be hanging on the OpenOPC.open_client method, I added some debug messages in this API and found that the following API in OpenOPC.py is hanging:
import Pyro.core
Pyro.core.initClient(banner=0)
server_obj = Pyro.core.getProxyForURI("PYROLOC://%s:%s/opc" % (host, port))
return server_obj.create_client() #this API is hanging
So if anyone has used OpenOPC to interface with OPC Servers, and has run into similar problem, please let me know. cheers!
When using OpenOPC in Linux, you can't use DCOM.
So you need to use OpenOPC Gateway Service and the "open_client" method.
This service must be installed and running in the actual OPC server for your client to access it.
My requirement is to communicate socketio with nodejs server to Raspberry Pi running a local Python app. Please help me. I can find ways of communication with web app on google but is there any way to communicate with Python local app with above mentioned requirements.
It's unclear exactly which part you need help with. To make a socket.io connection work, you do the following:
Run a socket.io server on one of your two computers. Make sure it is listening on a known port (it can share a port with a web server if desired).
On the other computer, get a socket.io client library and use that to make a socket.io connection to the other computer.
Register message handlers on both computers for whatever custom messages you intend to send each way and write the code to process those incoming messages.
Write the code to send messages to the other computer at the appropriate time.
Socket.io client and server libraries exist for both node.js and python so you can either type of library for either type of system.
The important things to understand are that you must have a socket.io server up and running. The other endpoint then must connect to that server. Once the connection is up and running, you can then send message from either end to the other end.
For example, you could set up a socket.io server on node.js. Then, use a socket.io client library for python to make a socket.io connection to the node.js server. Then, once the connection is up and running, you are free to send messages from either end to the other and, if you have, message handlers listening for those specific messages, they will be received by the other end.