B4J Question [WebSocket] What is the maximum length of the text message sent?

drgottjr

Well-Known Member
Licensed User
you can send binary data or strings. you have to tell the server what you're sending. the spec allows for a very, very large amount of data per frame, but the server on the answering end may have a default max size. if you're running the server, you'd have to check your config file. or find out from the server's administrator what the max is.
 

drgottjr

Well-Known Member
Licensed User
your server will/should have a configuration file. you need to check the documentation for it. hard to say which server you're running. generally, you edit a line of text in that file to set a maximum payload per frame, stop the server and restart it. you must have edited the configuration file when you first fired up the server, right? either you will add a line (if one is not already there) or you edit the one that is there.
 

Waldemar Lima

Active Member
Licensed User
using it, i have this error > http://prntscr.com/q68crc


B4X:
2019-12-04 16:19:00.944:INFO::JavaFX Application Thread: Logging initialized @627ms to org.eclipse.jetty.util.log.StdErrLog
WebSocket Connected
Erro = (IllegalStateException) java.lang.IllegalStateException: Interval must be larger than 0.
Erro = (RuntimeException) java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalStateException: Interval must be larger than 0.
websockethandler._ws_connected (java line: 116)
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalStateException: Interval must be larger than 0.
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:496)
    at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:434)
    at b4j.example.websockethandler._ws_connected(websockethandler.java:116)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
    at anywheresoftware.b4a.BA$3.run(BA.java:247)
    at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: Interval must be larger than 0.
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:120)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:487)
    ... 15 more
Caused by: java.lang.IllegalStateException: Interval must be larger than 0.
    at anywheresoftware.b4a.objects.Timer.setEnabled(Timer.java:76)
    at b4j.example.pushservice2._wsh2_connected(pushservice2.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
    ... 16 more
 

DonManfred

Expert
Licensed User
no you are not.
B4X:
Sub SetMaxTextMessage(size As Int)
   Dim jo As JavaObject = ws
   jo = jo.GetFieldJO("session").RunMethod("getPolicy", Null)
   jo.RunMethod("setMaxTextMessageSize", Array(size))
End Sub
I dont see you using this code in your screenshot. Or only partially.
 
Top