Hello, I have a problem with the folowing code:
this code gives me the following error:
I already tried the solutions posted in these other threads:
https://www.b4x.com/android/forum/threads/websocket-received-data-exceeds-limit.90678/#content
I tried both of the solutions posted in that thread this way:
only to end up with the same error
https://www.b4x.com/android/forum/threads/sending-binary-data-over-websocket.44776/#post-274162
I tried the solution posted on that thread this way:
and it gives me this error:
am I doing something wrong with these solutions? Or is there something else I can do to fix that message too large error?
B4X:
Dim script As String = $"
var video = document.getElementById('video');
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var img = document.getElementById('image');
canvas.width = video.clientWidth;
canvas.height = video.clientHeight;
context.drawImage(video, 0, 0);
img.src = canvas.toDataURL();
var aux = window.localStream;
aux.getTracks()[0].stop();
video.pause();
video.src = "";
return img.src
"$
Dim res As Future = page.ws.EvalWithResult(script,Null)
page.ws.Flush
Log(res.Value)
this code gives me the following error:
B4X:
org.eclipse.jetty.websocket.api.MessageTooLargeException: Text message size [77072] exceeds maximum size [65536]
I already tried the solutions posted in these other threads:
https://www.b4x.com/android/forum/threads/websocket-received-data-exceeds-limit.90678/#content
I tried both of the solutions posted in that thread this way:
B4X:
Private Sub WebSocket_Connected (WebSocket1 As WebSocket)
Dim ws1 As WebSocketClient
ws1.Initialize("ws")
Dim jo As JavaObject = ws1
jo = jo.GetField("wsc")
jo = jo.RunMethod("getPolicy", Null)
jo = jo.RunMethod("setMaxTextMessageSize", Array As Object (128000))
...
only to end up with the same error
https://www.b4x.com/android/forum/threads/sending-binary-data-over-websocket.44776/#post-274162
I tried the solution posted on that thread this way:
B4X:
Private Sub WebSocket_Connected (WebSocket1 As WebSocket)
Dim jo As JavaObject = WebSocket1
jo = jo.GetField("options") 'WebSocketOptions
jo.RunMethod("setMaxMessagePayloadSize", Array(4 * 1024 * 1024)) '4mb
...
and it gives me this error:
B4X:
java.lang.RuntimeException: Field: options not found in: anywheresoftware.b4j.object.WebSocket
am I doing something wrong with these solutions? Or is there something else I can do to fix that message too large error?
Last edited: