Package net.targetr.rc.client
Class JavaScriptSnippets
java.lang.Object
net.targetr.rc.client.JavaScriptSnippets
JavaScript snippets to help clients perform updates.
- Author:
- Dr Michael Gardiner
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringCreates a snippet to tell the client there are no pending updates.static StringcreateRoomFull(int maxClients) Stops automatic reconnects and displays an error when a room is full.static StringcreateUpdateHeader(String version) Creates a snippet to inform the client of a server update.static StringCreates a snippet to notify the client that the WebSocket is active.
-
Constructor Details
-
JavaScriptSnippets
public JavaScriptSnippets()Constructs a new JavaScriptSnippets.
-
-
Method Details
-
createUpdateHeader
Creates a snippet to inform the client of a server update.- Parameters:
version- the current server version- Returns:
- the JavaScript string
-
createNoUpdate
Creates a snippet to tell the client there are no pending updates.- Returns:
- the JavaScript string
-
createWsStart
Creates a snippet to notify the client that the WebSocket is active.- Returns:
- the JavaScript string
-
createRoomFull
Stops automatic reconnects and displays an error when a room is full. Uses existing client APIs so pages loaded before the server update can run it.- Parameters:
maxClients- the room's client limit- Returns:
- the JavaScript string
-