PrismarineJS / prismarine-viewer

Web based viewer for servers and bots
https://prismarinejs.github.io/prismarine-viewer/
MIT License
270 stars 72 forks source link

Browser-side support for path prefix is missing. #404

Open kashalls opened 1 year ago

kashalls commented 1 year ago

In late 2020, support for prefixes was added to the bot-side functionality. See here

We are, however, missing support for it in the browser-side. https://github.com/PrismarineJS/prismarine-viewer/blob/master/lib/index.js#L10

It should be as simple as adding an object to the io() function like:

const socket = io({
  path: customPrefix ? `${customPrefix}/socket.io/` : '/socket.io/'
}

Question is how do you want to implement this, as from what I see is that the browser doesn't pull any server options.

SocketIO Client Docs

extremeheat commented 1 year ago

Maybe a check for window.prismarineViewerPrefix? It'd be defined somewhere before prismarine-viewer loads on the page in the users' code.

kashalls commented 1 year ago

Maybe a check for window.prismarineViewerPrefix? It'd be defined somewhere before prismarine-viewer loads on the page in the users' code.

We can add that, where do you want to implement it at?