Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow cross-origin connections to websocket #56

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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.

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