WebSocketServices
WebSocketServices
This plug-in is an ongoing and evolving project with the intent to bring web support, through websockets, to the Minecraft bukkit servers. This implementation of websockets is designed to be light-weight and simple, reducing overhead to the game server itself. Clients that support websockets will have the ability to perform simple informational queries, such as who is online, what version the server is running on, etc. All text base results will be returned in a simple JSON format for consistency.
Services
Services are text-based methods that a client-side script can invoke through the WebSocketServices plug-in in order to retrieve more information about a Minecraft server. Additionally, each service can be enabled or disabled depending on the user's preference. The following services listed below are currently available and can be expanded through the use of custom plugins:
- Info - Information about the server such as the address, MOTD, version, game mode, etc.
- WHO - Information about the users currently online.
- Whitelist - Information about who is currently white-listed.
- Plugins - Information about all the plug-ins running on the server.
- OfflinePlayers - Information about all offline players.
- Player - Information about a specific player.
Sample site
A sample implementation of client-side scripting running against this plugin can be found at the URL listed below. The site is running in pure HTML5 & JS. Please note that the sample site requires an HTML5 & WebGL capable browser.
http://www.caffeinatedrat.com/minecraft/
Compatibility Notes
This plugin is only supported by browsers that support Websockets Protocol 13 RFC 6455. These browsers include:
- Firefox 11+
- Chrome 16+
- Safari 6+
- IE 10+
BUG NOTICE (Versions 1.1.6 and lower)
There is currently a bug in the offlinePlayer service, where all calls to it are rejected. It's a very simple fix and will be fixed in version 1.1.7. To fix the issue on your server, go to config.yml for this plug-in and rename the offlinePlayers to offlineplayers. It must be all lower case, as show below. I apologize for any inconvenience this may be causing at this time.
services: ... offlineplayers: true ...
Configuration
Detailed information about your servers configuration can be found here.
For Non-Developers
A client-side package is included with this plug-in, in the form of an example. In order to use the client-side package, you will have to have either a hosted web-site or a blog, where your server information can be viewed.
An example of a blog implementation can be found at http://blog.caffeinatedrat.com (apologies if the site cannot be reached. I'm currently having problems with my host).
For Developers
An additional client-side library called websocketservices.min.js is available on github and is included in the downloadable package. This library should be able to provide the most simplest of implementations. If you prefer something more complex or something that you'd like to tailor to your tastes, please read the sections below.
Client-Side Development Notes
The WebSocketServices API can be found at the github wiki location listed below.
https://github.com/CaffeinatedRat/WebSocketServices/wiki
Samples of code implementation can be found on github under 'examples/client-side/', as well as on the sample site listed above.
Extensions
WebSocketServices can be expanded through the use of custom development. Plug-ins can hook into the WebSocketServices server by creating their own ApplicationLayer and registering with static method WebSocketServices.registerApplicationLayer(Plugin plugin, IApplicationLayer applicationLayer). Further details will be released on the github wiki in the near future.
Source
Source code and further development of the plugin can be found at the following github repo:
How could i make a website like the sample?
Thank you!
WebSocketService, I like it very much. But if I'm in the settings, work in the setting with colors (example &5 &b…) In the line MOTD, the "info page" disappears.
@StanoMalek
Hello StanoMalek, I've sent you a private message to discuss the possibilities of setting this up.
How to join on web? :D
CFG
@xxmindpingxx
Thanks. Glad it's working out great. If you have any problems, please let me know.
@peasantlord
Hiya Peasantlord, I've sent you a private message so we can step through this and try to figure out what's wrong.
I tried your plugin out on my server this afternoon. Great work! Only problem I am running into is the only things that I get any information about are who's online, and the general server info. Whitelist, Offline, and Plugins all are blank. Is there something else I need to be doing to get those parts to work?
Players online: 2 out of 5 NoahJohnsDad(Online: 0d 0h 3m 8s) noahjohnswitzer(Online: 0d 0h 3m 19s)
works good here, thanks!
This plugin is really good, I invite more people to try it out!.
WebSocketServices v1.0.2 has been created with a potential fix for linux servers and is pending approval. WebSocketServices v1.0.1 had such minor changes they were rolled into version v1.0.2.
@Q2Lummox
This all looks correct. Nothing should be blocking the connection. I think it might be a handshaking issue. I'll open a ticket and look into resolving this, and will keep in touch via private messages. Thanks for your patience.
Ticket: http://dev.bukkit.org/server-mods/websocketservices/tickets/2-possible-handshaking-issue/
This is my config:
#Configuration for the websocket server.
websocket:
portNumber: 25564
#Logs to the console (0 = off, 1 = simple, 2 = verbose).
debug: 0
#Sets the maximum number of connections the server can handle concurrently.
maximumConnections: 32
#Sets the number of milliseconds that the server will wait for a handshake to complete.
handshakeTimeOutTolerance: 1000
#Sets the number of milliseconds that the server will wait for a the next frame before terminating the connection.
frameTimeOutTolerance: 15000
#Determines if the origin is valid during the handshake. If the origin is null, it is invalid and the connection is rejected.
checkOrigin: true
#Determines if the websocket services are only available to certain ips. Note that this checks the origin header field during the handshake and can be spoofed by non-browser clients.
whitelist: false
#Determines if the server is pingable via websockets.
pingable: true
#Configuration for the commands (services) that are supported.
services:
who: true
plugins: true
info: true
whitelist: true
ping: true
fragmentationtest: false
binaryfragmentationtest: false
-----------------------------
I tried to "checkorigin" to false and does not work.
I tested with:
fragmentationtest: true
binaryfragmentationtest: true
And it does not work ...
And now I understand that it does not work with your IP: D
If I have everything fine .... because me listed as "offline"?.
@Q2Lummox
Hi Q2Lummox,
The reason you're not able to see the status of my server with your webpage is due to a security constraint. Only the domains that I have white-listed will respond to any websocketservice queries.
Well this is odd. It looks like you have everything set up right. I am able to hit port 25564 on your server redminecraft.es, so it is available. The next thing I would like to know is how you have the plug-in configured. For example, is checkOrigin true or false, is the whitelist set to true or false? Do you have all the services set to true?
My test page doesn't works. I was introducing my IP in differents ways, and I also put your IP address for testing too, but, it still doesn't works.
I opened the ports in router and firewall, what is happening?.
If you visit my webpage www.redminecraft.es/nuevoestado you can see that it's always offline.
If you go to www.redminecraft.es/nuevoestado/js/minecraft.js you can see that it is configurated with your IP address... but it doesn't works...
How can I solve this problem?
@Q2Lummox
Sure, I've placed it on github at the following location below. Please note that this is just a demo page. You can create a page with your own look at feel, with simple websocket javascript calls. I'll have more information on the API on the github wiki in the near future.
https://github.com/CaffeinatedRat/WebSocketServices/tree/master/examples/client-side/fancy
Also note that you're going to have to update the minecraft.js to point to your ip address, as shown below.
Add your server address here, make sure the port number matches that of the port number in the websocketservices/config.yml. var websocketAddress = "ws://192.168.1.100:25564";
Awesome plugin, I love.
I was looking for something like this for a long time.
The sample page, you can put it to download?.
A greeting.