I am trying to setup Pusher to send messages from server to server. I do not need a client setup. I am trying to make the one server aware the other server is finished doing a particular task. Can anyone help with this?
Thanks
I work for Pusher. Have you tried using our server libraries? Some platforms have both a client (subscription) and server (publishing) library so you should be able to do what you want.
Related
I am making my home smart using esp32 and micropython. I have a Django project running on a server I have on my LAN and I want to send commands to my esp32 wirelessly through it. Maybe something like running a uvicorn server and a fastapi app and then sending messages to the uvicorn server endpoints and I have no idea how to do this.
You should probably use either Django Channels or django-websocket
But I'm not sure if websockets package is ported for micropython, so you might need to use plain socket
Or try something completely different. Physically connect the server and esp32 together (I have absolutely no idea about it)
My recommendation is the first option
Is there a way to see if my Discord bot is offline with a pyhton script? I'm trying to make a script that detects if my bot goes offline and it will run it in my other server if my host has a maintenance.
Is there any way to detect this?
You could follow the flask approach using uptimerobot to ping your web app every so often but this is limited to alerts if downtime is more than 5 minutes.
You could look at getting a reliable host that doesn't go down as often or looking at getting a VPS with a host with a high uptime SLA. You can look at https://uptime.is/ for seeing how long downtime is acceptable for a host.
If you know how to create good API servers, create a socket.io server, connect to it using your bot. Then listen for the disconnect event on the server then you know when your bot goes down/restarts.
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.
I have a Python client behind a NAT and a python server with a public IP address. My job is to send a pcap file (the size of a few MB) from the client to a server, as well as a dictionary with some data.
Is there any easy way of doing this without resorting to third-party libraries (e.g. twisted, tornado)?
If not, what's the easiest alternative?
I thought I could send the pcap file through http so that it would be easier to read it on the server side, and perhaps I could do the same with the dictionary by first pickling it. Would it be a good solution?
(I have complete control on the server, where I can install whatever)
Is FTP a usable solution for you?
https://docs.python.org/2/library/ftplib.html
http://effbot.org/librarybook/ftplib.htm
If you can install software on the server, and the server allows HTTP connections, you can write your own simple HTTP server (Python has libraries for doing that). If not, the answer would depend on what services are available on the server.
you can use just the classic sockets with TCP!
You just need to send the file via TCP sockets and receive it in a TCP socket server.
Read it as a file, send it and receive it.
This might give you some tip about sockets: https://docs.python.org/2/library/socket.html
Later I'll post a little script in case you didn't solve your doubt.
Using Java one would implement a BroadcastReceiver to use the "Google Cloud Messaging API for Android" and receive GCM multicast messages.
Can the same be achieved with Python (on a PC)? How?
Alternatively is is possible to get the messages on a PC running Ubuntu? (without using Chrome / the PC is a client / server is GAE)
My answer is for GCM implementations. If you are planning a server-and-client setup where the PC is the server (the clients will always be Android devices), you can still receive GCM messages. Instead of downstream messaging (server to client app), it would be upstream (client app to server). To do this, you would need to implement an XMPP setup. There is a Python sample at the bottom of that page.