tsung
                                
                                 tsung copied to clipboard
                                
                                    tsung copied to clipboard
                            
                            
                            
                        Help: Need help how to send ping frame or respond to ping frame over websocket.
Hi,
My xmpp server send a ping(empty message) upon client connect over websocket, but tsung not replying back with pong. causes socket close after 60sec. Could someone help me how to enable pin-pong flow? I'm using websocket_ssl type.
Thanks, Kishore.
I don't know is this correct or not, done following changes and Tsung starts responding for the ping. Excuse me if anything wrong, first-time I'm looking into Erlang code. I tested XMPP servers but not coded. -->ts_server_websocket_ssl.erl
{ssl, Socket, Data}->
            case websocket:decode(<<Buffer/binary, Data/binary>>) of
                more ->
                    ?DebugF("receive incomplete from server: ~p~n", [Data]),
                    loop(State#state{buffer = <<Buffer/binary, Data/binary>>});
                {?OP_PING, Payload, _} ->
                    ?DebugF("received ping from server: ~p~n", [Payload]),
                    Parent ! {gen_ts_transport, self(), Payload},
                    EncodedData = websocket:encode_pong(Payload),
                    ssl:send(Socket, EncodedData),
                    %%loop(State); 
                    loop(State#state{buffer = <<Buffer/binary, Data/binary>>});
in websocket.erl
encode_pong(Data) ->
    encode(Data, ?OP_PONG).
encode_ping(Data) ->
    encode(Data, ?OP_PING).