Constructor
new Application(settingsopt, clientLimitopt, appRouteropt, serveropt)
- Source:
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
settings |
object |
<optional> |
{}
|
Settings data to be forwarded to the server.
Properties
|
|||||||||||||||||||||||||||||||||||
clientLimit |
number |
<optional> |
10
|
The number of active clients that are allowed Not recommended. Prefer defining your own HTML, CSS, server, and routing. | |||||||||||||||||||||||||||||||||||
appRouter |
express.app |
<optional> |
predefined.routing.router()
|
Route handler to use. | |||||||||||||||||||||||||||||||||||
server |
http.Server |
<optional> |
http.createServer()
|
HTTP server to use. |
Members
ioServer
- Description:
- Socket.io instance using http server.
- Source:
Socket.io instance using http server.
messageHandler :module:server.MessageHandler
- Description:
- The MessageHandler responds to messages.
- Source:
The MessageHandler responds to messages.
Type:
namespace :Namespace
- Description:
- Socket.io namespace in which to operate.
- Source:
- See:
Socket.io namespace in which to operate.
Type:
- Namespace
router :express.app
- Description:
- Express app for routing.
- Source:
- See:
Express app for routing.
Type:
- express.app
settings :object
- Description:
- Settings for the application.
- Source:
Settings for the application.
Type:
- object
switchboard :module:server.Switchboard
- Description:
- The switchboard allows communication with clients
- Source:
The switchboard allows communication with clients
Type:
viewspace :module:server.ViewSpace
- Description:
- The main model for views.
- Source:
The main model for views.
Type:
workspace :module:server.WorkSpace
- Description:
- The main model for items.
- Source:
The main model for items.
Type:
(static) DEFAULTS :object
- Description:
- The default values for an Application.
- Source:
The default values for an Application.
Type:
- object
Methods
createItemGroup(values)
- Description:
- Create a group for existing items in the workspace. A group allows to interact with several elements simultaneously.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
values |
object | properties for the group |
createViewGroup()
- Description:
- Create a group for views in the viewspace. The views in a group will be able to perform multi-device gestures together.
- Source:
dispatch(action, payload)
- Description:
- Send Message to all clients to dispatch user-defined action.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
action |
string | name of the user-defined action. |
payload |
object | argument of the user-defined action function. |
removeItem(item)
- Description:
- Remove the given item from the workspace.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
item |
module:server.ServerItem | Item to remove. |
spawn(itemdata) → {module:server.ServerItem}
- Description:
- Spawn an object. Object type is determined by the `type` key value of the argument object.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
itemdata |
Object | Data describing the object to spawn. |
Returns:
The newly spawned object.
spawnElement(values) → {module:server.ServerElement}
- Description:
- Spawn a new element with the given values in the workspace.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
values |
Object | Data describing the element to spawn. |
Returns:
The newly spawned element.
spawnImage(values) → {module:server.ServerImage}
- Description:
- Spawn a new image with the given values in the workspace.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
values |
Object | Data describing the image to spawn. |
Returns:
The newly spawned image.
spawnItem(itemdata) → {module:server.ServerItem}
- Description:
- Spawn a new item with the given values in the workspace.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
itemdata |
Object | Data describing the item to spawn. |
Returns:
The newly spawned item.
(static) Application#addStaticDirectory(staticDir)
- Description:
- Add a static route to the router.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
staticDir |
string | The path to the static directory to add |
(static) Application#listen(portopt, hostopt)
- Description:
- Start the server on the given hostname and port.
- Source:
- See:
-
- module:server.Application~getLocalIP
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
port |
number |
<optional> |
9000
|
Valid port number on which to listen. |
host |
string |
<optional> |
getLocalIP()
|
IP address or hostname on which to listen. |