Class ServerExitNotice
java.lang.Object
com.iizix.server.ServerExitNotice
What a connected client is told when the server exits (CC-SERVER-RESTART-UPDATE-V5, the owner's texts of the survey's section 8): the WebSocket close reason of the close code measures it.
GCloseCodes.CC_SERVER_RESTART, "iz!4006!text", one text for a Browser and one for iiziRun on Cordova, where a page cannot be reloaded and the app is restarted instead. A close reason is at most 123 bytes of UTF-8, so every text here stays under 115 bytes with the 8-byte prefix;invalid reference
ServerExitNoticeTestA client of this release shows its own localized text for the code and keeps the server's text for a client that has none (an old cached page shows "WebSocket error 4006" and the text).
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe longest close reason the WebSocket protocol carries, in bytes of UTF-8.static final StringThe prefix of the reason: the close code for a client whose Browser drops the code.Method Summary
Field Details
MAX_REASON_BYTES
public static final int MAX_REASON_BYTESThe longest close reason the WebSocket protocol carries, in bytes of UTF-8.- See Also:
PREFIX
The prefix of the reason: the close code for a client whose Browser drops the code.- See Also:
Method Details
text
Gets the text a client is told for a server exit.- Parameters:
code- The exit code of the server:ServerExit.RESTART,ServerExit.UPDATE_RESTARTorServerExit.STOP.iiziRun- true for iiziRun on Cordova, false for a Browser.- Returns:
- The English text, without the prefix.
closeReason
Gets the close reason a client is sent: the prefix and the text.- Parameters:
code- The exit code of the server.iiziRun- true for iiziRun on Cordova, false for a Browser.- Returns:
- The reason, at most
MAX_REASON_BYTESbytes of UTF-8.
bytes
Measures a close reason.- Parameters:
reason- The reason.- Returns:
- Its length in bytes of UTF-8.