Javascript WebSocket in Logic Pro X Scripter

I have some code that relies on WebSocket to connect a device:

t = new WebSocket(this.getUrl());

But I get an error:

[JS Exception] ReferenceError: Can't find variable: WebSocket

The Logic Pro X Scripter documentation states:

The version of JavaScript used by the Scripter plug-in is determined by the JavaScriptCore framework version installed on your system. 

How do I determine which version of JavaScript is being used by the JavascriptCore framework? Is there an alternative to WebSocket available in the Scripter javascript engine?

Replies

JavaScriptCore does not provide a WebSocket implementation. Such support is always provided by the host app. For example, when you run JavaScript code in Safari, it sets things up so that your JavaScript code running in JavaScriptCore has access to Safari’s WebSocket implementation.

I’ve no idea whether the Scripter plug-in does the equivalent, or whether it provides some way to achieve similar goal )-:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Is there a way to tell Scripter to use a different javascript engine? or maybe I can import a websocket library?

Is there a way to tell Scripter to use a different javascript engine?

I don’t know. The Scripter plug-in is not something that we support here in DTS, so we don’t maintain expertise in it. Indeed, I’m not sure where you can go to get help on this. You could try over on Apple Support Communities, run by Apple Support, or search for other community sites that are dedicated to Logic itself.

or maybe I can import a websocket library?

That would only be possible if Scripter has set up JavaScriptCore with some sort of networking binding, and I don’t know whether that’s true. And that brings us back to the previous point )-:

Sorry I don’t have all the answers for you here.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"