I have been trying to get my socket to connect to my server. I’ve been looking around and it seems I need to send a certificate with it somehow. If I put in the path into the url the page returns {“code”:1,“message”:“Session ID unknown”}. It’s a error 400 in the console.
I found this post, I think he is using a droplet though, but seem like I need to setup something like it. https://www.digitalocean.com/community/questions/socket-io-call-throwing-400-bad-request-for-some-users
I am not using a droplet, I have hosted the react app on the app platform and made the server as component of it with its path at /api. I have configured socket.io to use that path and know it is correct due to the url returning that error code.
Thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @larryryan0824,
I can’t say I’ve actually had similar Apps being built so it’s just a short in the dark for me however, I’ve searched around DigitalOcean’s community, docs and tutorials and found those 2, hope they can be of some help until someone else answers this :
https://www.digitalocean.com/community/tutorials/angular-socket-io
Hope this helps!
I’m not sure if this is what’s causing the error, but just in case it helps:
made the server as component of it with its path at /api. I have configured socket.io to use that path and know it is correct due to the url returning that error code.
By default, if a component is configured with an HTTP route, the app/code will see incoming requests without the /api prefix. For example, a request coming in to /api/login will be rewritten to /login before being forwarded to the app.
If this is not the desired behavior, you can instruct App Platform to keep the prefix by following these steps:
preserve_path_prefix option to true...
services:
- name: api
routes:
- path: /api
preserve_path_prefix: true
...
For more info on the app spec, please see the reference.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.