soocrate-core
Version:
this is the core of soocrate application
1,492 lines (1,491 loc) • 884 kB
JSON
{
"type": "File",
"start": 0,
"end": 3769,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 106,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 3769,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 106,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 34
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 9
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 9
},
"identifierName": "io"
},
"name": "io"
}
}
],
"source": {
"type": "StringLiteral",
"start": 15,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 33
}
},
"extra": {
"rawValue": "socket.io-client",
"raw": "'socket.io-client'"
},
"value": "socket.io-client"
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "!\r\n * \\brief handle the signaling server\r\n * \\param rps the random peer sampling protocol\r\n * \\param signalingOptions specific options for the signaling server(s). For\r\n * now, it's an object { server, session, duration } where server is\r\n * the address of the server to contact, session is the editing session to join\r\n * or share, duration is the optional duration time during which the socket with\r\n * the signaling server stays open.\r\n ",
"start": 38,
"end": 482,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 11,
"column": 3
}
}
}
]
},
{
"type": "Identifier",
"start": 484,
"end": 3735,
"loc": {
"start": {
"line": 12,
"column": 0
},
"end": {
"line": 102,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 493,
"end": 502,
"loc": {
"start": {
"line": 12,
"column": 9
},
"end": {
"line": 12,
"column": 18
},
"identifierName": "Signaling"
},
"name": "Signaling",
"leadingComments": null
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 503,
"end": 506,
"loc": {
"start": {
"line": 12,
"column": 19
},
"end": {
"line": 12,
"column": 22
},
"identifierName": "rps"
},
"name": "rps"
},
{
"type": "Identifier",
"start": 508,
"end": 524,
"loc": {
"start": {
"line": 12,
"column": 24
},
"end": {
"line": 12,
"column": 40
},
"identifierName": "signalingOptions"
},
"name": "signalingOptions"
}
],
"body": {
"type": "BlockStatement",
"start": 525,
"end": 3735,
"loc": {
"start": {
"line": 12,
"column": 41
},
"end": {
"line": 102,
"column": 1
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 532,
"end": 547,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 19
}
},
"expression": {
"type": "AssignmentExpression",
"start": 532,
"end": 546,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 18
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 532,
"end": 540,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 12
}
},
"object": {
"type": "ThisExpression",
"start": 532,
"end": 536,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 537,
"end": 540,
"loc": {
"start": {
"line": 13,
"column": 9
},
"end": {
"line": 13,
"column": 12
},
"identifierName": "rps"
},
"name": "rps"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 543,
"end": 546,
"loc": {
"start": {
"line": 13,
"column": 15
},
"end": {
"line": 13,
"column": 18
},
"identifierName": "rps"
},
"name": "rps"
}
}
},
{
"type": "ExpressionStatement",
"start": 553,
"end": 594,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 45
}
},
"expression": {
"type": "AssignmentExpression",
"start": 553,
"end": 593,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 44
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 553,
"end": 574,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 25
}
},
"object": {
"type": "ThisExpression",
"start": 553,
"end": 557,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 558,
"end": 574,
"loc": {
"start": {
"line": 14,
"column": 9
},
"end": {
"line": 14,
"column": 25
},
"identifierName": "signalingOptions"
},
"name": "signalingOptions"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 577,
"end": 593,
"loc": {
"start": {
"line": 14,
"column": 28
},
"end": {
"line": 14,
"column": 44
},
"identifierName": "signalingOptions"
},
"name": "signalingOptions"
}
},
"trailingComments": [
{
"type": "CommentLine",
"value": "signalingOptions.server = \"http://127.0.0.1:5000\";",
"start": 600,
"end": 652,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 56
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 658,
"end": 765,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 17,
"column": 52
}
},
"expression": {
"type": "AssignmentExpression",
"start": 658,
"end": 764,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 17,
"column": 51
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 658,
"end": 677,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 23
}
},
"object": {
"type": "ThisExpression",
"start": 658,
"end": 662,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 8
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 663,
"end": 677,
"loc": {
"start": {
"line": 16,
"column": 9
},
"end": {
"line": 16,
"column": 23
},
"identifierName": "socketIOConfig"
},
"name": "socketIOConfig"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "ObjectExpression",
"start": 680,
"end": 764,
"loc": {
"start": {
"line": 16,
"column": 26
},
"end": {
"line": 17,
"column": 51
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 682,
"end": 710,
"loc": {
"start": {
"line": 16,
"column": 28
},
"end": {
"line": 16,
"column": 56
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "StringLiteral",
"start": 682,
"end": 704,
"loc": {
"start": {
"line": 16,
"column": 28
},
"end": {
"line": 16,
"column": 50
}
},
"extra": {
"rawValue": "force new connection",
"raw": "'force new connection'"
},
"value": "force new connection"
},
"value": {
"type": "BooleanLiteral",
"start": 706,
"end": 710,
"loc": {
"start": {
"line": 16,
"column": 52
},
"end": {
"line": 16,
"column": 56
}
},
"value": true
}
},
{
"type": "ObjectProperty",
"start": 741,
"end": 762,
"loc": {
"start": {
"line": 17,
"column": 28
},
"end": {
"line": 17,
"column": 49
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "StringLiteral",
"start": 741,
"end": 755,
"loc": {
"start": {
"line": 17,
"column": 28
},
"end": {
"line": 17,
"column": 42
}
},
"extra": {
"rawValue": "reconnection",
"raw": "'reconnection'"
},
"value": "reconnection"
},
"value": {
"type": "BooleanLiteral",
"start": 757,
"end": 762,
"loc": {
"start": {
"line": 17,
"column": 44
},
"end": {
"line": 17,
"column": 49
}
},
"value": false
}
}
]
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentLine",
"value": "signalingOptions.server = \"http://127.0.0.1:5000\";",
"start": 600,
"end": 652,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 56
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 771,
"end": 798,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 31
}
},
"expression": {
"type": "AssignmentExpression",
"start": 771,
"end": 797,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 30
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 771,
"end": 789,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 771,
"end": 775,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 776,
"end": 789,
"loc": {
"start": {
"line": 18,
"column": 9
},
"end": {
"line": 18,
"column": 22
},
"identifierName": "startedSocket"
},
"name": "startedSocket"
},
"computed": false
},
"right": {
"type": "BooleanLiteral",
"start": 792,
"end": 797,
"loc": {
"start": {
"line": 18,
"column": 25
},
"end": {
"line": 18,
"column": 30
}
},
"value": false
}
}
},
{
"type": "ExpressionStatement",
"start": 804,
"end": 823,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 23
}
},
"expression": {
"type": "AssignmentExpression",
"start": 804,
"end": 822,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 22
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 804,
"end": 815,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 15
}
},
"object": {
"type": "ThisExpression",
"start": 804,
"end": 808,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 809,
"end": 815,
"loc": {
"start": {
"line": 19,
"column": 9
},
"end": {
"line": 19,
"column": 15
},
"identifierName": "socket"
},
"name": "socket"
},
"computed": false
},
"right": {
"type": "NullLiteral",
"start": 818,
"end": 822,
"loc": {
"start": {
"line": 19,
"column": 18
},
"end": {
"line": 19,
"column": 22
}
}
}
}
},
{
"type": "ExpressionStatement",
"start": 829,
"end": 849,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 24
}
},
"expression": {
"type": "AssignmentExpression",
"start": 829,
"end": 848,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 23
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 829,
"end": 841,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 16
}
},
"object": {
"type": "ThisExpression",
"start": 829,
"end": 833,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 834,
"end": 841,
"loc": {
"start": {
"line": 20,
"column": 9
},
"end": {
"line": 20,
"column": 16
},
"identifierName": "timeout"
},
"name": "timeout"
},
"computed": false
},
"right": {
"type": "NullLiteral",
"start": 844,
"end": 848,
"loc": {
"start": {
"line": 20,
"column": 19
},
"end": {
"line": 20,
"column": 23
}
}
}
},
"trailingComments": [
{
"type": "CommentLine",
"value": " event id of the termination",
"start": 850,
"end": 880,
"loc": {
"start": {
"line": 20,
"column": 25
},
"end": {
"line": 20,
"column": 55
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 886,
"end": 903,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 21,
"column": 21
}
},
"expression": {
"type": "AssignmentExpression",
"start": 886,
"end": 902,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 21,
"column": 20
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 886,
"end": 898,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 21,
"column": 16
}
},
"object": {
"type": "ThisExpression",
"start": 886,
"end": 890,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 21,
"column": 8
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 891,
"end": 898,
"loc": {
"start": {
"line": 21,
"column": 9
},
"end": {
"line": 21,
"column": 16
},
"identifierName": "joiners"
},
"name": "joiners"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "NumericLiteral",
"start": 901,
"end": 902,
"loc": {
"start": {
"line": 21,
"column": 19
},
"end": {
"line": 21,
"column": 20
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentLine",
"value": " event id of the termination",
"start": 850,
"end": 880,
"loc": {
"start": {
"line": 20,
"column": 25
},
"end": {
"line": 20,
"column": 55
}
}
}
]
},
{
"type": "VariableDeclaration",
"start": 911,
"end": 927,
"loc": {
"start": {
"line": 23,
"column": 4
},
"end": {
"line": 23,
"column": 20
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 915,
"end": 926,
"loc": {
"start": {
"line": 23,
"column": 8
},
"end": {
"line": 23,
"column": 19
}
},
"id": {
"type": "Identifier",
"start": 915,
"end": 919,
"loc": {
"start": {
"line": 23,
"column": 8
},
"end": {
"line": 23,
"column": 12
},
"identifierName": "self"
},
"name": "self"
},
"init": {
"type": "ThisExpression",
"start": 922,
"end": 926,
"loc": {
"start": {
"line": 23,
"column": 15
},
"end": {
"line": 23,
"column": 19
}
}
}
}
],
"kind": "var"
},
{
"type": "VariableDeclaration",
"start": 939,
"end": 1560,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 43,
"column": 6
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 943,
"end": 1559,
"loc": {
"start": {
"line": 25,
"column": 8
},
"end": {
"line": 43,
"column": 5
}
},
"id": {
"type": "Identifier",
"start": 943,
"end": 952,
"loc": {
"start": {
"line": 25,
"column": 8
},
"end": {
"line": 25,
"column": 17
},
"identifierName": "callbacks"
},
"name": "callbacks"
},
"init": {
"type": "FunctionExpression",
"start": 955,
"end": 1559,
"loc": {
"start": {
"line": 25,
"column": 20
},
"end": {
"line": 43,
"column": 5
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 964,
"end": 970,
"loc": {
"start": {
"line": 25,
"column": 29
},
"end": {
"line": 25,
"column": 35
},
"identifierName": "socket"
},
"name": "socket"
},
{
"type": "Identifier",
"start": 972,
"end": 980,
"loc": {
"start": {
"line": 25,
"column": 37
},
"end": {
"line": 25,
"column": 45
},
"identifierName": "idJoiner"
},
"name": "idJoiner"
}
],
"body": {
"type": "BlockStatement",
"start": 981,
"end": 1559,
"loc": {
"start": {
"line": 25,
"column": 46
},
"end": {
"line": 43,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 992,
"end": 1547,
"loc": {
"start": {
"line": 26,
"column": 8
},
"end": {
"line": 42,
"column": 10
}
},
"argument": {
"type": "ObjectExpression",
"start": 999,
"end": 1546,
"loc": {
"start": {
"line": 26,
"column": 15
},
"end": {
"line": 42,
"column": 9
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 1014,
"end": 1165,
"loc": {
"start": {
"line": 27,
"column": 12
},
"end": {
"line": 30,
"column": 13
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1014,
"end": 1024,
"loc": {
"start": {
"line": 27,
"column": 12
},
"end": {
"line": 27,
"column": 22
},
"identifierName": "onInitiate"
},
"name": "onInitiate"
},
"value": {
"type": "FunctionExpression",
"start": 1026,
"end": 1165,
"loc": {
"start": {
"line": 27,
"column": 24
},
"end": {
"line": 30,
"column": 13
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1035,
"end": 1042,
"loc": {
"start": {
"line": 27,
"column": 33
},
"end": {
"line": 27,
"column": 40
},
"identifierName": "message"
},
"name": "message"
}
],
"body": {
"type": "BlockStatement",
"start": 1043,
"end": 1165,
"loc": {
"start": {
"line": 27,
"column": 41
},
"end": {
"line": 30,
"column": 13
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 1062,
"end": 1150,
"loc": {
"start": {
"line": 28,
"column": 16
},
"end": {
"line": 29,
"column": 77
}
},
"expression": {
"type": "LogicalExpression",
"start": 1062,
"end": 1149,
"loc": {
"start": {
"line": 28,
"column": 16
},
"end": {
"line": 29,
"column": 76
}
},
"left": {
"type": "Identifier",
"start": 1062,
"end": 1068,
"loc": {
"start": {
"line": 28,
"column": 16
},
"end": {
"line": 28,
"column": 22
},
"identifierName": "socket"
},
"name": "socket"
},
"operator": "&&",
"right": {
"type": "CallExpression",
"start": 1093,
"end": 1149,
"loc": {
"start": {
"line": 29,
"column": 20
},
"end": {
"line": 29,
"column": 76
}
},
"callee": {
"type": "MemberExpression",
"start": 1093,
"end": 1104,
"loc": {
"start": {
"line": 29,
"column": 20
},
"end": {
"line": 29,
"column": 31
}
},
"object": {
"type": "Identifier",
"start": 1093,
"end": 1099,
"loc": {
"start": {
"line": 29,
"column": 20
},
"end": {
"line": 29,
"column": 26
},
"identifierName": "socket"
},
"name": "socket"
},
"property": {
"type": "Identifier",
"start": 1100,
"end": 1104,
"loc": {
"start": {
"line": 29,
"column": 27
},
"end": {
"line": 29,
"column": 31
},
"identifierName": "emit"
},
"name": "emit"
},
"computed": false
},
"arguments": [
{
"type": "StringLiteral",
"start": 1105,
"end": 1113,
"loc": {
"start": {
"line": 29,
"column": 32
},
"end": {
"line": 29,
"column": 40
}
},
"extra": {
"rawValue": "launch",
"raw": "'launch'"
},
"value": "launch"
},
{
"type": "MemberExpression",
"start": 1115,
"end": 1139,
"loc": {
"start": {