Skip to content

Releases: yenfryherrerafeliz/server-client-messages

Messaging Server Clients.

29 Oct 06:20
e35b0a9
Compare
Choose a tag to compare

This project is designed to simplify the communication and data exchange in between multiple clients and a server.

We have an abstract class that contains the main logic for managing the messages. Then we have two implementations, one is for the client/station side and the other one is for the same client/station but at the server side. This last implementation at the server level is the endpoint for a client, which means that this implementation will be the channel/path to send and receive messages from a client/station. I call this implementation "representation of a client/station at the server side". The implementation at the client side will be a persistent connection one, which means that if a disconnection occurs so then it will try to reconnect until it gets connected. We also have a ping service in each side, that checks for connection in between the two sides.

When sending a message we send a SyncMessage object, and this object contains some properties, but the two ones that we should care for now are SyncRequest and SyncResponse, and they both extend from SyncCommonSharing. In those two objects are where we recommend to add the objects that you would like to send. For example if you would like to send an invoice to the server, so then just declare the invoice object inside of the SyncRequest or the SyncResponse object, or if this object will be used in both, so then just declare it inside of SyncCommonSharing. We also allow to share files, but we recommend not to send big files to prevent memory issues. The way that we have implemented now is sharing files encoded in base64. We already have a property called files inside of SyncCommonSharing, and this property is a list of an object called SyncFileBase64. This object contains properties to identify the file, and the property called "encodedContent" is the one where we should place the base64 string generated for the file ("We have a file helper to encode and decode the files").
A message could wait for a response, and could not, that is why we have two methods to send message.

Examples about how server and client can be implemented can be found under the following package "com.hatechnology.apps.sample". There you have an example for a client and an example for a server.

If you have any questions do not hesitate in letting me know. I will be happy to help. My email address is [email protected]