Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/spdy/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ proto._handleConnection = function _handleConnection (socket, protocol) {
connection.start(2)
}

// Pass the `ping` event to the server's EventEmitter as` _ping`. Pass the
// socket as an argument to the `_ping` event to allow identifying the
// connection that the ping was emitted from.
connection.on('ping', function () {
self.emit('_ping', socket)
})

connection.on('error', function () {
socket.destroy()
})
Expand Down
8 changes: 8 additions & 0 deletions test/server-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ describe('SPDY Server', function () {
}
})

it('server should emit _ping event', function (done) {
server.once('_ping', function (socket) {
assert(socket instanceof net.Socket)
done()
})
client.ping()
})

it('should process expect-continue request', function (done) {
var stream = client.request({
method: 'GET',
Expand Down