Skip to content

Commit 4d73ca3

Browse files
committed
add candidate message
1 parent 19a363d commit 4d73ca3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/server/parse-websocket.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ var common = require('../common')
55
function parseWebSocketRequest (socket, opts, params) {
66
if (!opts) opts = {}
77
params = JSON.parse(params) // may throw
8+
console.log(typeof params.info_hash)
9+
if(typeof params.info_hash === 'object'){
10+
var info_hash = params.info_hash;
11+
params.info_hash =String.fromCharCode.apply(null, info_hash)
12+
13+
}
14+
console.log(params.java, params)
15+
16+
817

918
params.type = 'ws'
1019
params.socket = socket
@@ -21,7 +30,7 @@ function parseWebSocketRequest (socket, opts, params) {
2130
}
2231
params.peer_id = common.binaryToHex(params.peer_id)
2332

24-
if (params.answer) {
33+
if (params.answer || params.candidate) {
2534
if (typeof params.to_peer_id !== 'string' || params.to_peer_id.length !== 20) {
2635
throw new Error('invalid `to_peer_id` (required with `answer`)')
2736
}

0 commit comments

Comments
 (0)