Skip to content

Tvhee-Dev/SimpleSockets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 

Repository files navigation

SimpleSockets

Usage

  1. To start connecting with sockets, create your connection instance
SocketConnection connection = SocketConnection.serverConnection(port); //Server side
SocketConnection connection = SocketConnection.clientConnection(IP, port); //Client side
  1. Create a new class implementing SocketHandler
public class MySocketHandler implements SocketHandler
{
        @Override
        public void handle(Socket socket, String message)
        {
                 //Your code here
        }
}
  1. Register your handler in your connection instance
connection.addHandler(new MySocketHandler());
  1. You are ready to go! Start the connection
connection.start();

Important

  1. I have built-in a duplicate message detector. It is important to prevent duplicates to prevent endless loops for example
  2. If you want to disable the duplication checker for ONE message use
socket.sendMessage(message, false);
  1. Please make sure to close the connection if the plugin gets disabled. This is important to prevent errors in the socket pipeline
connection.close();

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages