-
Notifications
You must be signed in to change notification settings - Fork 4
Constructor
Called during the instantiation of the WebSocketServices object, the constructor is responsible for initializing the object with user defined or default settings.
The following is the method signature:
CaffeinatedRat.Minecraft.WebSocketServices(parameters)
The following parameters can be supplied to the constructor. To pass parameters to the constructor, see the example below. If you do not specify an optional parameter in the parameter collection, then the default value will be used.
wss = new CaffeinatedRat.Minecraft.WebSocketServices({ websocketAddress: 'ws://localhost:25564', debug: true });
This is an optional parameter that indicates that the library will check for websocket support and throw the exception CaffeinatedRat.Minecraft.WebSocketServices.NotSupportedException if the browser does not support it. If this value is false then websocket check will be left to you.
- Value: true or false
- Default: true
The websocketAddress is a required parameter, without it the library will throw the exception CaffeinatedRat.Minecraft.WebSocketServices.InvalidAddressException. The websocketAddress can be any domain or ip address but must specify the websocket protocol.
Value: ws://your.domain.here.com
This parameter is used to determine the amount of time in milliseconds that the ping service will ping the WebSocketServer.
- Value: 0 - 2147483647
- Default: 15000 (milliseconds)
This parameter is used to determine the amount of time in milliseconds that the online service will request the online information from the WebSocketServer.
- Value: 0 - 2147483647
- Default: 15000 (milliseconds)
This parameter will enable logging to the console. Every service will write verbose information to the console. It is suggested that you keep this off unless you need to diagnose a problem.
- Value: true or false
- Default: false
This parameter is used to indicate where the library will pull the Minecraft skin images. Use this parameter to specify a custom skin server, such as an image proxy. Since the current Minecraft skin server does not support CORS, you will have to have a custom image proxy in order to use the webgl skinprofile library.
- Value: 'Your image server here'
- Default: 'http://s3.amazonaws.com/MinecraftSkins/'
This parameter will force the library to use a default skin for everyone and will not attempt to retrieve the skin from the image server.
- Value: true or false
- Default: false
This parameter is a url or a dataurl of the default skin to use in conjunction with the forceDefaultSkin parameter.
- Value: 'Your image's url or dataurl here.'
- Default: Steve's skin.
This parameter determines what type of interpolation the browser will use when stretching the image to fit the canvas. If this parameter is true, then the browser will use a better quality interpolation beyond nearest-neighbor, else nearest-neighbor is used to preserve the pixel quality of Minecraft.
- Value: true or false
- Default: false
This parameter will determine if a loading image will be shown, while the data is being downloaded from the WebSocketServer. If your server takes a long time or there is a lot of data to load from the WebSocketServer then enable this feature.
- Value: true or false
- Default: false
This parameter is a url or a dataurl of the loading image to display in conjunction with the showLoadingImage parameter.
- Value: 'Your image's url or dataurl here.'
- Default: 'A loading image'
This parameter is used to enable or disable the version mismatch warning. The version mismatch warning will be thrown if the client-side library is not the same version as the server-side plug-in.
- Value: true or false
- Default: true
The following exceptions are thrown by the constructor.
- CaffeinatedRat.Minecraft.WebSocketServices.NotSupportedException
- CaffeinatedRat.Minecraft.WebSocketServices.InvalidAddressException