Description:
The remote function in a websocket:Service class which returns an array type throws the following error and does not return the array to the console.
[2024-06-05 13:52:41,770] SEVERE {b7a.log.crash} - null
java.lang.NullPointerException
at java.base/java.lang.System.arraycopy(Native Method)
at io.ballerina.runtime.internal.values.ArrayValueImpl.getBytes(ArrayValueImpl.java:990)
at io.ballerina.stdlib.websocket.WebSocketResourceCallback.sendBinaryMessage(WebSocketResourceCallback.java:125)
at io.ballerina.stdlib.websocket.WebSocketResourceCallback.notifySuccess(WebSocketResourceCallback.java:81)
at io.ballerina.runtime.internal.scheduling.Scheduler.postProcess(Scheduler.java:387)
at io.ballerina.runtime.internal.scheduling.Scheduler.run(Scheduler.java:336)
at io.ballerina.runtime.internal.scheduling.Scheduler.runSafely(Scheduler.java:287)
at java.base/java.lang.Thread.run(Thread.java:833)
Steps to reproduce:
Write a remote function in a websocket:Service class that returns an array
public type Info record {|
string event;
|};
service class WsServiceUser {
*websocket:Service;
remote function onArray(Info info) returns int[] {
int[] arr = [1,3,5,6,7];
return arr;
}
}
Connect to the web-socket through the websocat command line client
websocat ws://localhost:9092/user
Send a subscription message with the event dispatcher key
{"event":"array"}
Affected Versions:
Ballerina Swan Lake Update 09
OS, DB, other environment details and versions:
OS: Ubuntu 22.04.4 LTS
Websocat: 1.13.0
Description: The
remote
function in awebsocket:Service
class which returns anarray
type throws the following error and does not return the array to the console.Steps to reproduce:
websocket:Service
class that returns anarray
websocat
command line clientevent
dispatcher keyAffected Versions: Ballerina Swan Lake Update 09
OS, DB, other environment details and versions: OS: Ubuntu 22.04.4 LTS Websocat: 1.13.0
Related Issues: https://github.com/ballerina-platform/ballerina-library/issues/4290