Commit 8bdfda09 authored by Wandenberg Peixoto's avatar Wandenberg Peixoto

send a ping frame as feedback when publishing a message through websocket connection

parent 5bf38799
......@@ -308,6 +308,13 @@ describe "Subscriber WebSocket" do
headers, body = read_response_on_socket(socket)
socket.print(frame)
body, dummy = read_response_on_socket(socket)
body.should eql("\211\000")
body, dummy = read_response_on_socket(socket)
body.should eql("\x81N{\"channel\":\"ch_test_publish_message_same_stream\", \"id\":\"1\", \"message\":\"hello\"}")
EventMachine.run do
pub = EventMachine::HttpRequest.new(nginx_address + '/channels-stats?id=' + channel.to_s).get :timeout => 30
pub.callback do
......
......@@ -281,6 +281,8 @@ ngx_http_push_stream_websocket_reading(ngx_http_request_t *r)
ngx_http_finalize_request(r, NGX_OK);
ngx_destroy_pool(temp_pool);
return;
} else {
ngx_http_push_stream_send_response_text(r, NGX_HTTP_PUSH_STREAM_WEBSOCKET_PING_LAST_FRAME_BYTE, sizeof(NGX_HTTP_PUSH_STREAM_WEBSOCKET_PING_LAST_FRAME_BYTE), 1);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment