Skip to content

Releases: mega12345mega/Simple-Packet-Library

Simple Packet Library - 1.0.1

28 Jan 06:28
322200f

Choose a tag to compare

Javadocs completed

Newly exposed public methods and classes were missing javadocs.

Fix undefined type variable

Fixed the undefined type variable error when using the library in specific contexts.

Simple Packet Library - 1.0.0

25 Jan 07:39
483baad

Choose a tag to compare

New Features:

WebSocket SSL Support

Use Server#setSecure(SSLContext) to set the certificate the server uses.
Use Server.generateSSLContext for a helper method when reading the certificate from a keystore.

TypedPacketListener

TypedPacketListener allows you to specify packet listeners for specific packet classes. Use TypedPacketListener#when(Class, GenericPacketListener) to add your listeners to it.

Connection timeouts

Use Client#setConnectTimeout to change the connection timeout. Previously, raw sockets used Java's default timeout, while web sockets used 5 seconds. They now both default to 5 seconds.

Alternate packet constructors

If you don't want to use a constructor taking in a DataInputStream for your packets, you can instead register with PacketRegistry#registerPacket(Class, PacketConstructor) which allows for more flexibility.

Default error handler

If you don't supply any error handlers, the error will now be printed by default, instead of being ignored. To stop printing, simply add an empty error handler.

Broadcasting packets

You can now send packets to all the ServerConnections directly from the Server, with optional exclusions.

Refactoring

Lots of major classes have been moved to different packages, so you will have to re-import lots of them. This has also exposed some internal parts of the library, which may lead to more official features in the future.

Bug Fixes:

Reading partial packets

Previously, if a packet hadn't fully arrived, the packet would be created anyway. This caused an error parsing the packet and then more errors when attempting to read more packets.

IllegalStateException when the Client is not connected

The Client now throws an IOException when a packet is attempted to be sent while it is not connected.

WebSocket server level error handling

Previously, errors from the server (instead of server connections) were handled incorrectly, leading to another error. Now, errors from the server are properly passed into the handlers, with the type GENERIC_WEBSOCKET.

Server connection error handlers

Previously, ServerConnection error handlers added on the Server class weren't passed on. Now, new connections get registered error handlers, and registering an error handler adds it to the current connections.

Catching exceptions

Previously, exceptions thrown from listeners were only caught and sent to error handlers if they were an IOException. This has been expanded to catch all Exceptions.

Connection listener call order

The connection listeners are now called after the connection has been added to the connection list.

Performance

Thread.yield() has been converted to Thread.sleep(1) in the listener invokers.

Simple Packet Library - 0.1.0 (beta)

01 Jun 04:45
48da1bc

Choose a tag to compare

Pre-release

New Features:

WebSocket support

Use Client#useWebSocket(true) and Server#useWebSocket(true) to use a WebSocket instead of a normal Socket.
This allows the library to connect to its JavaScript counterpart.

Improved Error Handling

Instead of simply printing out any errors to the console, you can now use Client#addErrorHandler, Server#addServerErrorHandler, Server#addConnectionErrorHandler, and ServerConnection#addErrorHandler to add better error handlers to the specific parts of the library. The error handlers include the Exception, the source object (a Client, Server, or ServerConnection), and an enum describing what the library was doing.

Function chaining & more getters

Several methods that previously returned null now return this, and the Client and Server classes now have a getter for the ip (Client only) and port.

Simple Packet Library - 0.0.0 (beta)

21 Mar 06:11
aee108f

Choose a tag to compare

Pre-release
v0.0.0

Add files via upload