@@ -406,35 +406,32 @@ var wss = new ws.Server({
406406 path: "/helloworld"
407407});
408408
409- wss.on("connection", function(ws) {
409+ wss.on("connection", function (ws) {
410410 var sessionId = null;
411411 var request = ws.upgradeReq;
412412 var response = {
413413 writeHead: {}
414414 };
415415
416- sessionHandler(request, response, function(err) {
416+ sessionHandler(request, response, function (err) {
417417 sessionId = request.session.id;
418418 });
419419
420- ws.on("error", error => {
420+ ws.on("error", ( error) => {
421421 stop(sessionId);
422422 });
423423
424424 ws.on("close", () => {
425425 stop(sessionId);
426426 });
427427
428- ws.on("message", _message => {
428+ ws.on("message", ( _message) => {
429429 var message = JSON.parse(_message);
430430
431431 switch (message.id) {
432432 case "start":
433433 sessionId = request.session.id;
434- start(sessionId, ws, message.sdpOffer, function(
435- error,
436- sdpAnswer
437- ) {
434+ start(sessionId, ws, message.sdpOffer, function (error, sdpAnswer) {
438435 ws.send(
439436 JSON.stringify({
440437 id: "startResponse",
@@ -524,11 +521,9 @@ function start(sessionId, ws, sdpOffer, callback) {
524521 }
525522 }
526523 // Connect it back on itself (i.e. in loopback)
527- connectMediaElements(webRtcEndpoint, error => {
528- webRtcEndpoint.on("OnIceCandidate", function(event) {
529- const candidate = kurento.getComplexType(
530- "IceCandidate"
531- )(event.candidate);
524+ connectMediaElements(webRtcEndpoint, (error) => {
525+ webRtcEndpoint.on("OnIceCandidate", function (event) {
526+ const candidate = kurento.getComplexType("IceCandidate")(event.candidate);
532527 ws.send(
533528 JSON.stringify({
534529 id: "iceCandidate",
@@ -537,18 +532,15 @@ function start(sessionId, ws, sdpOffer, callback) {
537532 );
538533 });
539534
540- webRtcEndpoint.processOffer(
541- sdpOffer,
542- (error, sdpAnswer) => {
543- sessions[sessionId] = {
544- pipeline: pipeline,
545- webRtcEndpoint: webRtcEndpoint
546- };
547- return callback(null, sdpAnswer);
548- }
549- );
535+ webRtcEndpoint.processOffer(sdpOffer, (error, sdpAnswer) => {
536+ sessions[sessionId] = {
537+ pipeline: pipeline,
538+ webRtcEndpoint: webRtcEndpoint
539+ };
540+ return callback(null, sdpAnswer);
541+ });
550542
551- webRtcEndpoint.gatherCandidates(error => {
543+ webRtcEndpoint.gatherCandidates(( error) => {
552544 if (error) {
553545 return callback(error);
554546 }
@@ -576,7 +568,7 @@ function createMediaElements(pipeline, ws, callback) {
576568
577569` ` ` javascript
578570function connectMediaElements(webRtcEndpoint, callback) {
579- webRtcEndpoint.connect(webRtcEndpoint, error => {
571+ webRtcEndpoint.connect(webRtcEndpoint, ( error) => {
580572 if (error) {
581573 return callback(error);
582574 }
@@ -635,7 +627,7 @@ function start() {
635627 onicecandidate: onIceCandidate
636628 };
637629
638- webRtcPeer = kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options, function(error) {
630+ webRtcPeer = kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options, function (error) {
639631 if (error) return onError(error);
640632 this.generateOffer(onOffer);
641633 });
@@ -660,7 +652,7 @@ WebSocket メッセージが受信されると、通信の開始、ICE 候補の
660652のいずれかが発生するたびに、適切な処置がとられます。
661653
662654` ` ` javascript
663- ws.onmessage = function(message) {
655+ ws.onmessage = function (message) {
664656 var parsedMessage = JSON.parse(message.data);
665657
666658 switch (parsedMessage.id) {
@@ -772,7 +764,7 @@ function createMediaElements(pipeline, ws, callback) {
772764 -1.2,
773765 1.6,
774766 1.6,
775- function(error) {
767+ function (error) {
776768 if (error) {
777769 return callback(error);
778770 }
@@ -786,11 +778,11 @@ function createMediaElements(pipeline, ws, callback) {
786778
787779` ` ` javascript
788780function connectMediaElements(webRtcEndpoint, faceOverlayFilter, callback) {
789- webRtcEndpoint.connect(faceOverlayFilter, error => {
781+ webRtcEndpoint.connect(faceOverlayFilter, ( error) => {
790782 if (error) {
791783 return callback(error);
792784 }
793- faceOverlayFilter.connect(webRtcEndpoint, error => {
785+ faceOverlayFilter.connect(webRtcEndpoint, ( error) => {
794786 if (error) {
795787 return callback(error);
796788 }
@@ -954,12 +946,12 @@ function createMediaElements(pipeline, ws, callback) {
954946
955947``` javascript
956948function connectMediaElements (webRtcEndpoint , filter , callback ) {
957- webRtcEndpoint .connect (filter, error => {
949+ webRtcEndpoint .connect (filter, ( error ) => {
958950 if (error) {
959951 return callback (error);
960952 }
961953
962- filter .connect (webRtcEndpoint, error => {
954+ filter .connect (webRtcEndpoint, ( error ) => {
963955 if (error) {
964956 return callback (error);
965957 }
@@ -1014,7 +1006,7 @@ function plateDetected(message) {
10141006
10151007## ライセンス
10161008
1017- [MIT](LICENSE) © 2018-2020 FIWARE Foundation e.V.
1009+ [MIT](LICENSE) © 2018-2022 FIWARE Foundation e.V.
10181010
10191011プログラムには、ライセンスの下で入手した追加のサブモジュールが含まれています :
10201012
0 commit comments