Octoprint Javascript Client Socket help


#1

What is the problem?
Hello, I'm just trying to set up a socket connection to the Sockjs sock on the server and I'm using the Octoprint JS Client Library.

What did you already try to solve it?
I set up the baseurl and apikey to the global Octoprint instance and try to setup the connection.
But I get the TypeError saying SockJS is not a constructor.

I include "/static/webassets/packed_client.js" and am able to retrieve file info with "OctoPrint.files.list()..." but for some reason unable to instantiate a new OctoPrintClient instance with "var client = new OctoPrintClient()". I get the error saying it is not defined. Am I missing a js components?

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...)

I am accessing/sending requests to the OctoPrint instance(version 1.4.0-rc6, the current master) set up on a webpage over the internet (printer port forwarded). CORS is enabled and I'm using the global API key to test thing out. Not safe I know but this current setup is not permanent.


#2

Could you share your code, or a minimal example that shows the same trouble?