mondora / asteroid

An alternative client for a Meteor backend
MIT License
734 stars 101 forks source link

WebSocket is not defined #99

Closed dfischer closed 8 years ago

dfischer commented 8 years ago

Trying readme example and I'm getting

ReferenceError: WebSocket is not defined app/bot/node_modules/asteroid/lib/base-mixins/ddp.js:46:67)

davidebianchi commented 8 years ago

Hi @dfischer,

If you use Asteroid in an environment without native WebSocket implementation, you can use an external module, like ws.

For example:

import {createClass} from "asteroid";
import ws from "ws";

const Asteroid = createClass();

const asteroid = new Asteroid({
    endpoint: "ws://localhost:3000/websocket",
    SocketConstructor: ws
});
dfischer commented 8 years ago

Wonderful, thanks.