Skip to content

Commit

Permalink
updates a many, including time outs and seq numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
codybum committed Apr 11, 2024
1 parent d8be73b commit efca4a8
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/io/cresco/wsapi/websockets/APIDataPlane.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public APIDataPlane() {
@OnOpen
public void onWebSocketConnect(Session sess)
{

sess.setMaxIdleTimeout(0);
sess.setMaxBinaryMessageBufferSize(1024 * 1024 * 1024);
sess.setMaxTextMessageBufferSize(1024 * 1024 * 1024);

Expand Down Expand Up @@ -223,11 +223,17 @@ public void onMessage(Message msg) {

} else if (msg instanceof BytesMessage) {
String transferId = msg.getStringProperty("transfer_id");
//logger.error("INCOMING TRANSFER ID: " + transferId);


String seqNum = String.format("%1$" + 6 + "s", msg.getStringProperty("seq_num")).replace(' ', '0');
//logger.error("INCOMING TRANSFER ID: " + transferId + " seq: " + msg.getStringProperty("seq_num"));
//System.out.println("onMessage(Message msg) transferId: " + transferId);
long dataSize = ((BytesMessage) msg).getBodyLength();
byte[] bytes = new byte[(int)dataSize];
((BytesMessage) msg).readBytes(bytes);
if(msg.getStringProperty("seq_num") != null) {
bytes = Bytes.concat(seqNum.getBytes(), bytes);
}
if(transferId != null) {
bytes = Bytes.concat(transferId.getBytes(), bytes);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public APILogStreamer() {
@OnOpen
public void onWebSocketConnect(Session sess)
{
sess.setMaxIdleTimeout(0);
sessions.add(sess);
String logSessionId = UUID.randomUUID().toString();
sessionMap.put(sess.getId(),logSessionId);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/io/cresco/wsapi/websockets/APISocket.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public APISocket() {
@OnOpen
public void onWebSocketConnect(Session sess)
{
sess.setMaxIdleTimeout(0);
sess.setMaxBinaryMessageBufferSize(1024 * 1024 * 1024);
sess.setMaxTextMessageBufferSize(1024 * 1024 * 1024);
sessions.add(sess);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/io/cresco/wsapi/websockets/EventSocket.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class EventSocket
@OnOpen
public void onWebSocketConnect(Session sess)
{
sess.setMaxIdleTimeout(0);
sessions.add(sess);
//System.out.println("Socket Connected: " + sess);

Expand Down
1 change: 1 addition & 0 deletions src/main/java/io/cresco/wsapi/websockets/LogSocket.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public LogSocket() {
@OnOpen
public void onWebSocketConnect(Session sess)
{
sess.setMaxIdleTimeout(0);
sessions.add(sess);
String logSessionId = UUID.randomUUID().toString();
sessionMap.put(sess.getId(),logSessionId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public LogStreamerNew() {
@OnOpen
public void onWebSocketConnect(Session sess)
{
sess.setMaxIdleTimeout(0);
sessions.add(sess);
//System.out.println("Socket Connected: " + sess);

Expand Down

0 comments on commit efca4a8

Please sign in to comment.