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

'io' is not defined #11

Open
peterpme opened this issue Apr 13, 2020 · 1 comment
Open

'io' is not defined #11

peterpme opened this issue Apr 13, 2020 · 1 comment

Comments

@peterpme
Copy link

peterpme commented Apr 13, 2020

Hey everyone,

Awesome library! I'm running into an error. All I've done is

  • install bs-socket
  • Copy Messages.re
  • Copy BsSocket.Client.make:

MyClient.re

module Client = BsSocket.Client.Make(Messages);
let socket = Client.createWithUrl("http://localhost:3000");

MyClient.bs.js

// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE

import * as Curry from "bs-platform/lib/es6/curry.js";
import * as React from "react";
import * as Belt_Array from "bs-platform/lib/es6/belt_Array.js";
import * as Client$BsSocket from "bs-socket/src/Client.bs.js";
import * as Messages$Codenames from "./Messages.bs.js";

var Client = Client$BsSocket.Make(Messages$Codenames);

// ...

function Game(Props) {
  var id = Props.id;
  React.useEffect((function () {
          var socket = io(); <---- BREAKS HERE
          console.log(socket);
          console.log(id);
          return ;
        }), ([]));
}

Any help would be appreciated, thank you!

Am I supposed to be importing io somewhere?

@ralake
Copy link

ralake commented May 23, 2020

Seems to work for me if you include the socket-ui script in the head of the html sync, rather than install socket.io as a package...

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

No branches or pull requests

2 participants