Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 07 21:07

    jkarneges on develop

    ensure keep-alives are sent in … (compare)

  • Nov 06 2020 21:45

    jkarneges on master

    handler: make http publish maxi… Merge pull request #47691 from … Merge remote-tracking branch 'o… and 7 more (compare)

  • Nov 06 2020 21:44

    jkarneges on v1.31.0

    (compare)

  • Nov 06 2020 21:44

    jkarneges on develop

    update version (compare)

  • Nov 02 2020 23:59

    jkarneges on develop

    use condure by default (compare)

  • Nov 02 2020 22:32

    jkarneges on develop

    runner: support for ssl ports w… (compare)

  • Oct 09 2020 04:53

    jkarneges on develop

    ensure queueable events are onl… (compare)

  • Oct 02 2020 05:12

    jkarneges on develop

    avoid adding extra minutes to r… (compare)

  • Sep 24 2020 23:12

    jkarneges on develop

    handler: split out wssession make it possible to refresh web… (compare)

  • Sep 10 2020 21:47

    jkarneges on develop

    readme nits, remove mailing list Merge remote-tracking branch 'o… (compare)

  • Sep 10 2020 21:46

    jkarneges on master

    readme nits, remove mailing list (compare)

  • Aug 13 2020 18:17

    jkarneges on develop

    handler: make http publish maxi… Merge pull request #47691 from … (compare)

  • Jul 29 2020 18:41

    jkarneges on v1.30.0

    (compare)

  • Jul 29 2020 18:40

    jkarneges on master

    limit body bytes to internal bu… runner: support condure service use client_maxconn and condure_… and 1 more (compare)

  • Jul 29 2020 18:40

    jkarneges on develop

    update version (compare)

  • Jul 28 2020 02:16

    jkarneges on develop

    use client_maxconn and condure_… (compare)

  • Jul 28 2020 02:12

    jkarneges on develop

    runner: support condure service (compare)

  • Jul 22 2020 01:42

    jkarneges on develop

    limit body bytes to internal bu… (compare)

  • Jul 15 2020 18:45

    jkarneges on v1.29.0

    (compare)

  • Jul 15 2020 18:45

    jkarneges on master

    fix crash when parsing accept h… provide credits on websocket ac… fix crash when response hold ti… and 10 more (compare)

Justin Karneges
@jkarneges
@niranjan-kmit what part of your stack is handling SSL termination though? is pushpin handling it, or something in front of pushpin?
ccbeloy
@ccbeloy
Hi @jkarneges I work with @niranjan-kmit. To answer your question, pushpin is fronted by AWS ALB which is doing the SSL termination and forwarding the request to pushpin on http or ws. What could be the possible issue here? This was previously working and just started getting this issue last week.
Justin Karneges
@jkarneges
Hi @ccbeloy, if there is no m2a log line associated with the websocket connection attempt, then the connection must be failing very early. maybe a misconfiguration was introduced with ALB or something external to pushpin?
you could try connecting a websocket directly to pushpin to see if that still works
Erick
@ericklind
I've got a basic node express server working with pushpin using websockets over http. I'm using serve-grip & grip and I really like how things are progressing. The question that I have is how do we setup ping/pong heartbeats to check for disconnected clients? I have scoured the docs and while I found reference to being able to send ping/pong, I have found nothing showing how this might be accomplished. It has also been mentioned in this room, but again with no explanation as to how. Can you point me to any examples? Thanks.
Justin Karneges
@jkarneges
hi @ericklind, are you saying you want to send pings from the server to the client?
Erick
@ericklind
Yes.
Justin Karneges
@jkarneges
Justin Karneges
@jkarneges
for example, to configure pushpin to send a PING frame whenever there is 30 seconds of inactivity, you could use this control message: c:{"type": "keep-alive", "message-type": "ping", "content": "", "timeout": 30}
to send a control message using WebSocketContext from serve-grip, do it like ws.sendControl({"type": "keep-alive", "message-type": "ping", "content": "", "timeout": 30})
Erick
@ericklind
Thanks. Can I recommend adding that to the JS docs? Small things like that are useful. I read up on the keep-alives last night, but then reading further it was a bit confusing and seemed like that was not the way to go. As someone new in this area, there's terminology and concepts that are not self explanatory, so examples are pretty key.
Justin Karneges
@jkarneges
@ericklind I agree on that :) thanks for the feedback
Erick
@ericklind
@jkarneges So when that kicks off a ping, are we supposed to handle the pong, or does pushpin handle it and automatically disconnect the websocket if it's not received?
Justin Karneges
@jkarneges
@ericklind pushpin just forwards the pong to the backend. what is your goal? often it's fine for the backend to not care about whether connections exist or not, in which case dead connections can be cleaned up by the OS when tcp times out
Erick
@ericklind
The client socket is returning analytics (ip, location, etc) on the init. After that it’s just sending back info like if the page is currently active or not. That info is like a ping/pong but I’m not sure what I want the interval to be so I was also checking out the idea of a heartbeat. It may be redundant in this case, but i want to understamd how it all works.
So in this case, do I just close() or disconnect(), or both?
Justin Karneges
@jkarneges
@ericklind unless you have a specific need to track the presence of connections, I wouldn't worry about processing pongs or explicitly trying to close dead connections or anything
on the server side I'd simply ack closes (if ws.recv() returns null, call ws.close()) and ignore disconnects
Justin Karneges
@jkarneges
heartbeats from server->client can be useful even if the server isn't tracking connections though. for example, the server could send a message every 30 seconds, and if the client receives nothing in the last 60 seconds then the client can assume its connection is dead. in this case, it may be better for the server to use a TEXT frame for the heartbeat (instead of PING) since a reply would not be required
Erick
@ericklind
What is the difference, and how would that be done? Would I hold onto each wsContext and call wsContext.send(?)? Or is there a collection on the req.grip that has all the connections? (Docs are kind of lacking on this area)
Justin Karneges
@jkarneges
@ericklind definitely don't hold on to WebSocketContext. that's a temporary object which only lives as long as the current http request being handled by the backend. you can use a keep-alive control message to tell pushpin to send TEXT frames for you
ws.sendControl({"type": "keep-alive", "content": "still alive", "timeout": 30})
ccbeloy
@ccbeloy
@jkarneges - just to update from our side with regards to 502 ALB issue. It just start working, we did not do any change. So I guess its a misconfiguration issue with ALB. Thanks.
ccbeloy
@ccbeloy
Hi @jkarneges is there a limit on how many channels a single pushpin instance could handle? Are channels expensive in Pushpin?
Also found this in the pushpin config "connection_subscription_max=20". Is this the max number of channels per client connection? Can this be increased in a much larger number? And will be the drawback?
Thanks.
Justin Karneges
@jkarneges
@ccbeloy channels are not too expensive, but they have an expense. tens of thousands of channels in one instance should be fine. feel free to increase connection_subscription_max, just be mindful of the potential amplification that could cause
ccbeloy
@ccbeloy
Thanks @jkarneges
Jimmy Marquez
@jimmysp_gitlab

Hi @jkarneges
I am trying to send messages to pushping using 0mq but I am unable to do it, I am using the following code:

ZMQ.Context context = ZMQ.context(1);
ZMQ.Socket publisher = context.socket(ZMQ.PUB);
publisher.connect("tcp://" + ip + ":5562");
publisher.send("J{\"id\": \"an-item-id\", \"channel\": \"test\", \"formats\": {\"http-stream\": {\"content\": \"a chunk of data\n\"}}}",0);
publisher.close();
context.term();

I am also using the following versions of 0MQ,

zeromq-4.1.4
zeromq/jzmq

The code does not display an error but messages are not appearing in pushpin logs.

Any suggestion related to this? might I be missing something?

Justin Karneges
@jkarneges
hi @jimmysp_gitlab , you need to send a multipart message, where the first part is the channel, and the second part is the payload
some other things to consider. there must be at least one subscriber, otherwise your publisher won't actually send anything to pushpin (and nothing will get logged). and it can take a moment for subscription information to be sent to the publisher. I suggest adding a 500ms sleep between the connect() and send()
ASHMEET KANDHARI
@ashmeet-kandhari

Hi @jkarneges ,

We are trying to publish messages through ZeroMQ to pushpin and something that we noticed was, if the message has new line characters (\n) the message breaks
For eg if we are trying to publish a json to pushpin it will not be a json as new line characters are parsed.
Can you suggest how can we make ZMQ escape the new line characters in the original message?

Thanks

Justin Karneges
@jkarneges
hi @ashmeet-kandhari , this is not expected behavior. what does your publishing code look like?
ASHMEET KANDHARI
@ashmeet-kandhari
Hi @jkarneges,
Here is our code
 ZMQ.Context context = ZMQ.context(1);
 publisher = context.socket(ZMQ.PUB);
 publisher.connect("tcp://localhost:5562");
 Thread.sleep(700);
String channelId = "test-channelId";
String messageId = data.getId();
String serializedWebSocketEvent = gson.toJson(data);
ZMsg zMsg = new ZMsg();
zMsg.addString(channelId);
zMsg.addString(getBodyMessage(channelId,serializedWebSocketEvent));
zMsg.send(publisherSubSocket);


private String getBodyMessage(String messageId,String channel,String content){
    StringBuilder bodyMessage = new StringBuilder();
    messageId = Strings.isNullOrEmpty(messageId) ? UUID.randomUUID().toString().replace("-","") : messageId;
    bodyMessage.append("J{\"id\": \"")
            .append(messageId)
            .append("\",")
            .append("\"channel\": \"")
            .append(channel)
            .append("\",")
            .append("\"formats\": {\"")
            .append("ws-message")
            .append("\":{\"content\":\"")
            // Note: Having new line characters messes the message in zeromq
            .append(content.replace("\\n","").replace("\"","\\\"") )
            .append("\"}}}");
    return bodyMessage.toString();
}
ASHMEET KANDHARI
@ashmeet-kandhari

Here is a sample json

{ "id": "someID", "message": { "termsContent": "This is a test\n.To demo" , "terms": "not valid" } }

Justin Karneges
@jkarneges
@ashmeet-kandhari ah, you need to escape the content. I suggest either generating the published item using a json encoder rather than concatenating strings (in which case the content field would get escaped as part of that process), or json-encode just the content value and use that in your string concatenations
ASHMEET KANDHARI
@ashmeet-kandhari
@jkarneges actually we already serializing a pojo object using gson String serializedWebSocketEvent = gson.toJson(data);.
Still we were facing this issue, so we had to explicitly remove the \n chars
Justin Karneges
@jkarneges
@ashmeet-kandhari I think you would need to serialize twice. once to go from source object to message string, and again to escape the message string within the published item object
ASHMEET KANDHARI
@ashmeet-kandhari
sure @jkarneges will try and let you know, thanks
ricopollantecs
@ricopollantecs
how to subscribe websocket with authentication?
Justin Karneges
@jkarneges
hi @ricopollantecs , the subscription control messages come from your backend server, so this is up to you. for example you could require the client to provide authentication information in the query string when connecting, or in a message after connecting, and your backend would decide whether to apply a subscription to the connection
Vinay Kumar K
@vinayvbn
Hi @jkarneges does pushpin grip library for java supports multiple channels creation at one go? if yes may i get some reference please
Justin Karneges
@jkarneges
hi @vinayvbn , that somewhat depends on the http library you use. GripControl.createGripChannelHeader creates a single header value. if your http server library supports setting multiple values for the same header name, then you can just call that method multiple times and set the result. if not, you'll need to join the values with a semicolon ; and set as a single value
Vinay Kumar K
@vinayvbn
Hi @jkarneges ryt now we are creating channel using grep control messages, so as per suggestion can we pass multiple channelid's seperated by ; . will it work? GripControl.webSocketControlMessage("subscribe", "channel_id;channel_id1,)
Justin Karneges
@jkarneges
@vinayvbn oh, for WebSockets you can simply send multiple control messages
my previous answer was for the HTTP transport, where channels are specified in HTTP headers that could be combined or not. however, for the WebSocket transport, channels are always specified as individual control messages
Rob Flores
@robflores13
Has anyone experienced stream timeouts after 15 minutes? We have a system that uses pushpin to stream data, and after 15 minutes the connection gets dropped. When the client tries to reconnect it receives err_connection_timed_out messages for a number of attempts, and then the connection can be re-established? There's no significant idle time on the connection as there is always data flowing. Grip Keep-Alives have been been implemented and they don't help. There's no network reason for the dropped connection (no firewall timing out the connection, nor another proxy). There is only 1 client accessing the stream. We can replicate the connection drop using Curl, not jsut JS in Chrome. We are running pushpin through a docker container. Could docker be terminating the connection after 15 minutes? Can anyone suggest something to look into, or have experience dealing with strange connection interruptions?
Justin Karneges
@jkarneges
hi @robflores13 , by no other proxy, does that mean no load balancer either then? and no Kubernetes? the client just connects to the docker container and times out?
Rob Flores
@robflores13
There is a loadbalancer (netscaler) infront of pushpin. We have 2 pushpin containers running in docker (no kubernetes) load balanced by a netscaler. No other firewalls between the clients and the endpoints.
I'm looking into config settings on the netscaler now, and looking into docker networking to see where the connection interruption could be happening. I came here to explore any pushpin behaviors I'm not aware of, or if anyone had experienced something similar.
Justin Karneges
@jkarneges
ah yes, I should say that is not expected behavior :)
Rob Flores
@robflores13
ok, cool. That points me a little more towards networking behavior outside of pushpin. I'll go check the load balancer configs and docker configs in more detail.