Written by

Question Trung Vu · Aug 1, 2017

WebSocket error

Hi,

I'm trying to use WebSocket for my application. I am trying to get the example in this link (http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY…) to work. However, I keep getting the error "CSP application closed the connection before sending a complete response". Does anyone know why?

Thanks,

 

Trung

Comments

Timothy Leavitt · Aug 1, 2017

In a bit of testing, I was able to see this by using the wrong protocol - i.e., navigating to the web socket directly in the browser, or using http or https in the client code when it should be ws or wss. The "client code" in the documentation you linked should go in a separate page (CSP or just plain old HTML/JS) from the class that extends %CSP.WebSocket, and navigating to /csp/user/MyApp.MyWebSocketServer.cls (as in that example) directly will not work.

If that isn't clear or doesn't solve the problem, could you share your code and your Caché version ($zv)? Your web server and browser version may also be relevant, since web sockets are fairly new.

0
Trung Vu  Aug 1, 2017 to Timothy Leavitt

Thanks Timothy. I was quite naive when testing the web socket -- I just navigated directly to the link in Google Chrome. It worked when I implemented a separate JS client code. 

0