These are chat archives for fanout/pushpin

19th
Aug 2018
Sumit Chahal
@smtchahal
Aug 19 2018 04:38
Hi @jkarneges, I need to be able to tell from my backend whether or not a client is "online", and the client should be able to update its status to "offline" even if it's still connected to Pushpin (over WebSocket). One way to do this is to publish a message from the backend that the client expects and responds to, and then wait for this response in the backend, but this is not synchronous and I was wondering if a better approach was possible using Pushpin.
Adrian
@picarsite
Aug 19 2018 18:18
@jkarneges How do you test your app when you answer the http request with ws.send(...) and you broadcast a message to a channel with expressGrip.publish(..., ...) in the same function? How do you test whether the boradcasted message is right?
Justin Karneges
@jkarneges
Aug 19 2018 18:56
@smtchahal if you're building user presence, I think it's best to develop that mostly outside of Pushpin. it's tempting to want to use the existence of a TCP connection (and thus, subscription) as an indicator of presence, but in practice this often leads to ghosting
I suggest having a presence table in your DB, with timestamp. clients ping the server periodically and you keep the data in the table. a client is online if it's in the table with a recent timestamp (e.g. within the past 30 seconds or whatever you decide is acceptable)
in a way, the actual tracking of presence isn't really a push problem. informing others about presence changes is though, and that's where Pushpin could come in
Justin Karneges
@jkarneges
Aug 19 2018 19:03
well I take that back slightly. all pubsub systems have to track subscribers which is of course a form of presence. what I mean is "user" presence, which is sometimes better handled separately
@picarsite only way to do that is with a real websocket client test
Adrian
@picarsite
Aug 19 2018 21:12
@jkarneges Thanks. I'm trying to run a pushpin docker container with the --net="host" parameter: docker run -dt --name pushpindev --net="host" pushpindev. In the dockerfile there is a variable which is set: ENV target app:8080 and used here CMD ["sh", "-c", "/usr/bin/pushpin --merge-output --port=7999 --route=\"* ${target},over_http\""]. I want to "link" the pushpin docker container with my host system directly so that it connects with my app which I'm debugging on my host system. Tried to use localhost, 127.0.0.1 and the local ip address of host system. Nothing does work. I don't receive any requests in my docker container. What I'm doing wrong? My build command: docker run -dt --name pushpindev --net="host" pushpindev. Thank you.
Adrian
@picarsite
Aug 19 2018 21:26
host.docker.internaldoes also not work.
Justin Karneges
@jkarneges
Aug 19 2018 21:42
I think I've gotten that to work before. let me try
Justin Karneges
@jkarneges
Aug 19 2018 21:50
works for me with: --net=host -e target=localhost:80
hitting port 7999 gets me my local webserver
Adrian
@picarsite
Aug 19 2018 22:10
Hm. I'm doing something wrong. My app listens on the port 8080 but when I run the container with the following command docker run -dt --name pushpindev --net=host -e target=localhost:8080 pushpindev the container still does not receive any requests but my app answers on direct 8080 http reqests.
(when I use postman)
Adrian
@picarsite
Aug 19 2018 22:58
10.0.75.1 does also not work :'(
Justin Karneges
@jkarneges
Aug 19 2018 23:27
what error do you get?
assuming pushpin is reachable, and the real problem is pushpin can't reach the backend, then you should get an error response from pushpin