Socket4MC - Sockets for Minecraft servers

This is a discussion topic for the Ore project, Socket4MC. View the full project on Ore for downloads and more information.


.

.

You don’t like Plugin Messaging Channels?
You want to use sockets but you think it’s too difficult for you?
This API allows developers to send data from Bungee to Spigot/Sponge and from Spigot/Sponge to Bungee.

:diamonds: Use Sockets (in case you haven’t understood yet)

:diamonds: Very easy-to-use

:diamonds: Call Bungee and Spigot/Sponge events

:diamonds: Lightweight, fast, efficient

:diamonds: Encrypted data transfer (RSA encryption)

You have to install and configure Socket4MC on BungeeCord and on all your Spigot/Sponge servers

BungeeCord configuration:

port: 25575
name: "MyBungee"
security-level: 1
password: "My Secret Password"

Spigot/Sponge configuration:

host: "localhost"
port: 25575
name: "MySponge" // or "Factions", "Lobby", ...
password: "My Secret Password"

:diamonds: host: BungeeCord’s address (e.g. mc.rhaz.fr, localhost) Set it to localhost if you don’t know what is it

:diamonds: port: A port used for communication (not the same as your BungeeCord port)

:diamonds: name: The server name (e.g. Factions, SmashBros) in lower case

:diamonds: security-level:

0=no security,

1=AES encryption,

2=AES encryption and RSA keys sent

:diamonds: password: A password used to prevent third party connections

----------------- on Sponge -------------------

// Send a message "Ping!" to BungeeCord over channel "MyChannel"
public void sendPing()
	JSONMap map = new JSONMap(
		"message", "Ping!"
	);

	Socket4Sponge.getClient().write("MyChannel", map);
}

// Send it when it is connected
@Listener
public void onHandshake(ClientSocketHandshakeEvent e){
	sendPing();
}

------------------- on BungeeCord -------------------

@Override
public void onEnable() {
   getProxy().getPluginManager().registerListener(this, this);
}

// Receive a message "Ping!" from Spigot and send "Pong!"
@EventHandler
public void onSocketMessage(ServerSocketJSONEvent e){

	String channel = e.getChannel(); // The channel name
 
	if(!channel.equals("MyChannel")) return;

	String name = e.getName(); // The name of the server

	String message = e.getExtraString("message");
 
	getLogger().info("Received message from " + name + ": " + message);

	if(message.equals("Ping!")){
		e.write("message", "Pong!"); // Quick reply to this channel
	}
 
}

.

.

1 Like

A new version has been released for Socket4MC, it is available for download here.


Socket Manager for Minecraft servers

A new version has been released for Socket4MC, it is available for download here.


Socket Manager for Minecraft servers

A new version has been released for Socket4MC, it is available for download here.


You no longer need to set the security level for the client-side
Both sides can now process multiple messages at the same time