I'm trying to connect my Meteor's frontend app to a remote server (that exposes its API via a websocket connection) by using Meteor's DDP.connect(url) function:
import { Meteor } from "meteor/meteor";
import { DDP } from 'meteor/ddp-client';
Meteor.Remote = DDP.connect("ws://my-site.com/websocket");
But instead of established connection i receive the following error in console:
XMLHttpRequest cannot load ws://my-site.com/websocket....
Cross origin requests are only supported for protocol schemes: http, data, chrome,
chrome-extension, https, chrome-extension-resource.
What am i doing wrong here?
While Meteor uses webSockets, the DDP.connect call is just for talking to another Meteor server. You can use webSockets like you would in any node/js app for a regular web socket connection