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:
@caffeinatedrat
That you need additional ports should be no problem, I think.
Bungee, used for example with me about 45 KB Java, nothing more.
Here is what a plugin example the players on the server increments of online status. :-)
Global joins 4:
http://www.spigotmc.org/resources/global-joins.106/
Would be fantastic, yes spigot is the better version of CraftBukkit with Bungee together. :-)
And I will test if you have something.
I have local Bungee, with 3 MC-Servers, and online with two MC-Servers.
Runs on Vhost Windows Server 2008R2 with 16GB Ram.
Greetings Jens
@jeracom
I'll look into it. I already have the setup running on my computer, so I can begin development. You may want to consider though, that it might be better to have silo-ed (isolated) websites for each server due to some of the services the WebSocketServer provides. For example, the Server Info tab could become extremely cluttered, especially if the number of servers exceed 5. The services like the who, offline, and whitelist would consolidate so that would not be a problem, but the plugin tab would be another issue where the information would become too verbose.
Also consider, that the WebSocketServices plugin is its own server. This means when you run it with minecraft, you are actually running two servers and are consuming 2 ports, one for Minecraft, one for the WebSocketServer. Adding one to BungeeCord does not eliminate the need for these ports. So with BungeeCord, you'll be consuming 2 ports + 2 ports per Minecraft server.
@caffeinatedrat
That's it.
Similar BungeeCord itself, a plugin in Bungee plugin folder.
Or a plugin in two minecraft servers plugin folder, talking to each other.
:-)
@jeracom
So what you'd really like is a consolidated websocket address, so you can just have one page?
I'll look into working on this, but it's a bit complicated seeing as the websocket server is its own server built into Minecraft. It means I'll have to create a proxy server plugin for Bungee.
@caffeinatedrat
I now have two pages for one server:
http://www.minecraft-24.de/sfu_classic
http://www.minecraft-24.de/sfuc_hunger
WebSocked can already work with spigot. Bungee has its own plugin folder. I think it would have to establish a bridge.
Bungee has an Api.
http://ci.md-5.net/job/BungeeCord/modules
That would, of course, good for large servers.
@caffeinatedrat
There are a Bunggecord server with port, and for example two Minecraft servers with Port.
The ports are for example 25565 for BungeeCord server.
25566 for Minecraft one server.
25567 for Minecraft two server.
The BungeeCord has onlinmode true, and the two MC Server must have false.
Only Port from BungeeCord is open to connect.
Look http://www.spigotmc.org/
BungeeCord connects, for example the Minecraft Server 1 with Minecraft Server 2. Each Minecraft Server server has its own course websocked port.
Since this would be otherwise occupied. The MInecraft servers are then connected via portals. (Example bungee portal)
Here's an example BungeeCord yml server (Adress faked):
is a very difficult task, I know :-)
@jeracom
I'm not sure how BungeeCord works at this time. Do you know if it consolidates all servers into one ip address and one port? If not, the websocket server should continue to run for each server and work independently on each separate port.
Hello, I rise again.
My server is growing and I wanted to ask whether it is possible to collect support for BungeeCord. Under spigot, websocked is already running. Or is it possible to add two servers?
Server1 = user 3,
user Server2 = 5,
Number of players = 7 user
Great, works fine with spigot
@moisesortiz
Hi Moisesortiz,
I don't see why it wouldn't be possible to use this with Enjin. You could use an Iframe, but the point of this plug-in is to develop it the way you see fit for your site. The examples are just there to provide an insight on how to do it. If you really wanted, you could say, have one div that shows the players, and nothing else. I've set up an example on my blog.
For example, this would just show who (Who template info) is online in a small div, pulling the information from my server:
Is there anyway adding this to enjin? I mean like [iframe]?
@to175
@to175
Hi to175, creating a chatbox for this plug-in is a bit difficult, no so much displaying the chat that is going on the server, but to chat with those on the server. It'll require an authentication extension, that would also require that everyone had their own custom password in order to log-in and start chatting via this plug-in. I have it on my to-do list, but it may be a while. Sorry about this.
Hi, chatbox please !
How can I go onto it?
I sometimes even can't log onto it!
I'm in Apple!
@auyeungyat
I'm not sure I understand completely, but you need to have webserver software running to host webpages, such as IIS on windows, Apache, or Nginx. If you have this already, you simply need to drop the files in the client-side example folder. You will then have to change the minecraft.js file to point to your local address and websocketserver port, such as shown below.
Change
wss = new CaffeinatedRat.Minecraft.WebSocketServices({ websocketAddress: 'ws://<Your IP Address here>:25564' });
to
wss = new CaffeinatedRat.Minecraft.WebSocketServices({ websocketAddress: 'ws://localhost:25564' });
Make sure that you have a firewall rule for port 25564 so that it is available. This port number maybe different depending on what you've configured in the config.yml file.
I have installed on my bukkit server.But when I want to go onto the server's website,I have asked for a Authorise.What can I type?
@BiweGas
You'll need to place the files found under the fancy examples folder on a webserver. You'll then have to change the minecraft.js so that the webSocketAddress points to your minecraft server. For example, I'd change the following to point to my minecraft server.
Change
wss = new CaffeinatedRat.Minecraft.WebSocketServices({ websocketAddress: 'ws://<Your IP Address here>:25564' });
to
wss = new CaffeinatedRat.Minecraft.WebSocketServices({ websocketAddress: 'ws://minecraft.caffeinatedrat.com:25564' });
where should i add client-side folder?