How to overwrite monaco's websocket service

Viewed 14

I'm using Monaco's editor simply to display simple examples of HTML, XML, and other language formats. No codebases are used here—simple files only.

Currently, we are using a custom WebSocket server to broadcast changes made to a single file to everyone in the room.

For some reason, Monaco's editor is opening a second connection to another room in the WS service

enter image description here

I would like to completely overwrite this service so that Monaco's editor doesn't interfere with my Websocket connections.

From the docs I can pass a third argument to the constructor to overwrite editor services. What I have tried so far

const websocketService = {
    getName() {},
    doOpen() {},
    addEventListeners() {},
    write() {},
    doClose() {},
    uri() {},
    check() {},
}

editorMonaco = monaco.editor.create(document.getElementById('file_editor'), {
            value: data,
            language: 'xml',
            automaticLayout: true
        }, {
            wsService: websocketService,
            websocketService,
            websocket: websocketService,
            webSocket: websocketService,
            webSocketService: websocketService,
        });

Unfortunately, it isn't working with either one of the keys.

How can I completely disable Websocket interference from Monaco's editor? The Websocket communication is being handle by us

0 Answers
Related