Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.
I currently have a connection to qlik that is based on websockets and JSON, that is run through a C# script in the Unity engine.
It works perfectly fine to begin with, but after roughly 3 minutes, the connection is lost and I get an ObjectDisposedException which makes me unable to recieve Qlik messages.
Part of the exception:
ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.NetworkStream'.
System.Net.WebConnection.Read (System.Net.HttpWebRequest request, System.Byte buffer, System.Int32 offset, System.Int32 size) (at <f044fe2c9e7e4b8e91984b41f0cf0b04>:0)
System.Net.WebSockets.ClientWebSocket+<ReceiveAsync>c__AnonStorey5.<>m__0 () (at <f044fe2c9e7e4b8e91984b41f0cf0b04>:0)
My method for recieving messages form Qlik:
private static async void ReceiveWs(ClientWebSocket ws)
// Keep listening while socket is open
while (ws.State == WebSocketState.Open)
// Receive in chunks through byte array
String resultString = "";
Byte bufferByte = new byte;
incoming = await ws.ReceiveAsync(new ArraySegment<byte>(bufferByte), CancellationToken.None);
resultString += Encoding.UTF8.GetString(bufferByte).TrimEnd('\0');
I think the problem originates in this code, but I am not quite sure. Any help is appreciated!