spraakbanken / swell-editor

Editor for normalising learner texts (error annotation and tagging.)
MIT License
9 stars 3 forks source link

websocket can't establish a connection #197

Closed LordOfInternet closed 1 year ago

LordOfInternet commented 1 year ago

Hey,

if it's not too much bother, could I ask you a few follow up questions?

Although it doesn't seem to effect the working of the application, I am getting an error that WebSocket connection to 'ws:hosting.com' failed. (Chrome console log, FF console log puts it a bit differently).

Why is a web socket used in this case, and should I be worried that it might cause issues somewhere along the way?

As swell isn't hosted on the root domain, but is in a subdirectory (hosting.com/swell), I've had to change the websocket path (dist/index.js <- line 229), by adding the subdirectory.

(so the error is actually WebSocket connection to 'ws:hosting.com/swell' failed.)

Do you perhaps know, if any other changes should be made and where?

Any suggestions and advice is also always welcome =)

Complete console.log (Chrome) WebSocket connection to 'ws://hosting.com/swell/' failed: undefined [parcel] Connection to HMR server was lost

Thank you, keep up the good work

arildm commented 1 year ago

I have no idea where "hosting.com" might come from, could it be related to configuration on your machine? The websocket connection seems to be used for hot module replacement (HMR), i.e. so that it the page will update automatically when you make changes in the code. (This is done when running yarn serve, but not when you do yarn build for deployment in production.) But for me it connects to localhost (ws://localhost:1234/) and there's no error message about it.

LordOfInternet commented 1 year ago

Sorry, I was unclear. hosting.com is not the real address. I'm hosting it on my domain and I just used hosting,com as an example.

I zip the dist directory and create a subfolder on my hosting provider (ie: swell -> hosting.com/swell). I then unizp the file and change the "links" (hrefs, srcs, etc) to point to the swell folder.

Alright, so websockets are used to update on the fly. This is not an issue for me since I'm using the final build.

Thank you, and sorry to bother you with such issues.

Edit: Unrelated, but I tried running yarn run serve again after the first time and it threw an error. I'm currently not running ubuntu, so I can't tell you what the error was exactly. I'll try running the command again when I'll be making changes to swell. If the issue reappears I'll open a new ticket.

arildm commented 1 year ago

Alright! Yes, then you will want to use yarn build (= yarn run build) to create the dist/ directory.