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:
@Madminor
It's The Spark - Digital Blasphemy, I think.
https://chrome.google.com/webstore/detail/the-spark-digital-blasphe/lhkknnebkjlngeopapiainhbhkeeihkk?hl=en
which chrome theme you using in the picture?
Version WebSocketServices v1.2.0-R6 is pending, which contains the new player service and upgraded to use bukkit 1.5.1-R0.2.
@nullschritt
Hi Nullschritt,
I would rather the plug-in be in a stable, beta state before I release it, it's just sort of my obsessive need to have stable working products. :P An experimental build, and the code is all available on github.
https://github.com/CaffeinatedRat/Spectator
@PP19
PP19,
You can find all the experimental build and the client-side script at github at the following location:
https://github.com/CaffeinatedRat/Spectator/tree/master/build
Again, remember this is experimental, so there are still bugs that are present and the data being sent between the server & the client is not optimized, so there are performance issues. Also, with it being experimental, the camera will always take the location of the first player that bukkit returns, which is not necessarily the first person who has logged in, but just how bukkit sorts player's names. There is also no defined behavior for alternate environments, such as The Nether or The end.
@caffeinatedrat
You should post a link to it, I think a lot of people would like to play around with embeded it on their sites! (:
@caffeinatedrat
Yes, that would be nice. Should i send you my email-address via PM?
@sp0ng3b0b
Hi sp0ng3b0b,
It is possible, but it'd have to be a WebSocketServer extension. I have thought about writing one for a while, but two issues must be addressed first.
1) There are currently a few security issues with WebSockets. For one, creating such a plug-in creates a tunnel to your server giving anyone direct access as opposed to an additional layer of security that a host provides hiding it within a secure server. While there is a white-list feature with this plug-in, anyone who is capable and intelligent enough can spoof the origin and circumvent the white-list; this is a flaw of the WebSockets technology itself. The white-list is currently nothing more than a deterrent. Another issue is this plug-in does not support SSL for websockets, and even if it did, most people would not be willing to spend the monthly expense for a cert. Currently this plug-in only performs read-only queries, which can expose information about someone's server, but does not allow anyone to change the state of the server. This wouldn't be the case with an extension that provided admin tools. Finally, an authentication mechanism would have to be created, so that an admin would have to log-in to their server before they could change server states; furthermore, since it would be a non-ssl log-in, it would be susceptible to man in the middle attacks, where skill exploiters could capture your log-in info and take control of your server. Of course, this is a vulnerability of any website that does not use a SSL log-in in the first place.
2) The next issue deals with the fact that this plug-in is designed mostly for developers. Most websites are not driven by client-side scripting, but this plug-in is, so any user would have to have a website already in place and would have to modify that website to take advantage of the client-side nature of the plug-in. While this works great for people that already have websites in place, it doesn't work well for those that are starting from scratch and do not know how to create a website or integrate this tool into said website. I've tried to make this plug-in as user friendly as possible, even for those that have no knowledge of web development, but it really isn't enough.
I still plan on developing a simple admin tool, but it will have to be an extension, so that this plug-ins main functionality remains as read-only queries.
By the way, if you are a developer, there is a way to write extensions to this plug-in. The experimental plug-in spectator, is an extension to the WebSocketServer and provides some limited examples as to how to add create your own extension or even extend current plug-ins to use the WebSocketServer.
Hopefully this is enough to answer your question, and I am sorry I do not already have such functionality available. It would be if it was a trivial matter.
Is it Possible to add something like a Livewebconsole for admins only? Would be really good, because i have never found something similar.
@PP19
Hi PP19,
The Spectator plug-in is in an experimental state and is not ready for use; however, I can still provide you with client-side code for you to review.
Could you add the Spectator Tab of the example to the ClientSide example?
@Lolmewn
Excellent, let me know if you need any help or have any issues. I don't believe I have the WebSocketService extension development documented that well yet.
I'm totally going to hook into this for Stats.
Version WebSocketServices v1.2.0-R5 is in development. The following changes will be included in the new version:
Version WebSocketServices v1.1.9-R4 is pending to hopefully fix an issue addressed in ticket Time Issue.
Started documenting the client-side library WebSocketServices.min.js, which can be found at
WebSocketServices.min.js Client-Side API
@rulystarw
Hello Rulystarw,
You can start by taking the HTML in the Client-Side/example/fancy folder and copy everything in that folder to any webserver that you have. It should run as is, as long as you are running it on a webserver. Next, modify the minecraft.js under the folder Client-Side/example/fancy/js and change the websocketAddress to yours, as shown below:
I'm sorry it's not that detailed, but I have not had time to document step-by-step instructions on how to setup the example website on a webserver.
How Do I Install This To An proper website We i can access it from anyway like they did here http://www.caffeinatedrat.com/minecraft/
@caffeinatedrat
I have tested the version. Now the Dev Version 1.1.8 also shows the plugins with Lockette. :-)
Great Job :-)
@jeracom
Looks like you've helped me discover another small bug. See the ticket. I'll have this fixed in 1.1.8.
http://dev.bukkit.org/server-mods/websocketservices/tickets/5-plugin-services-are-blank-again-with-the-plugin-lockette/