Skip to content

Conversation

@kivle
Copy link

@kivle kivle commented Oct 14, 2020

Hi,

This is just a tiny pull-request to allow cross-origin connections to the websocket to fetch data. The code already adds cors headers for HTTP-requests, but the websocket library has it's own internal blocking mechanism that can be overridden by passing your own callback. I don't know if I've done this in an optimal way. This is my very first time playing around with Go code.

I have been playing around with my own map front-end that is a bit like a "virtual guide" that fetches Wikipedia articles from around you and reads them out loud using text-to-speech. To use it cross-origin connections need to be allowed. The map front-end I've been working on can be found at https://kivle.github.io/msfs-map and you can check out the code at https://github.com/kivle/msfs-map. I've built it using create-react-app and react-leaflet. Run vfrmap from this branch and then just open the map. It should automatically connect to ws://localhost:9000/ws.

Helge Elvik added 6 commits October 14, 2020 19:09
Changed deprecated call to ioutil into a new call direcly on the os
package.
Removed unreachable code.
Changed string conversion function to a newer one that has proper error
handling when conversion fails.
Removed usages of deprecated functions.
Removed redundant type declarations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant