Class: socket_server

socket_server


new socket_server(io, setting, openspace)

OpenSpace WebSocket related communication method

Parameters:
Name Type Description
io library

socket.io library

setting object

The configuration object

openspace library

lib/openspace library

Properties:
Name Type Description
io library

socket.io library

config object

The configuration object stored from the parameter

userList array

The list of connected clients

cameraAccess array

The list of clients who can access camera

planetAccess array

The list of clients who can access planet change

adminID array

The socket id of admin

Source:

Methods


initAdmin(type, socket)

Function to initialize admin frontend content

Parameters:
Name Type Description
type string

'add' / 'remove' / 'init' / 'refresh'

socket object

The socket object

Source:

initUser(socket, io, id, target, content)

Function to initialize user frontend content

Parameters:
Name Type Description
socket object

The socket object

io library

socket.io library

id int

The user id

target string

The frontend DOM id

content string

The frontend content

Source:

checkAccess(socket, type)

Function to check if a user can access certain control

Parameters:
Name Type Description
socket object

The socket object

type string

The type of control

Source: