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

require(..) is not a function #55

Closed
pljeskavica opened this issue Apr 5, 2016 · 1 comment
Closed

require(..) is not a function #55

pljeskavica opened this issue Apr 5, 2016 · 1 comment

Comments

@pljeskavica
Copy link

I am trying to build a tool to connect to a socket.io server from within UE4. I have been running into problems trying to add socket.io-client as a dependency. I have written a small test script to try and use socket.io-client and every time I try I get a lot of errors where the system will not allow socket.io-client to require any of its own dependencies.

To reproduce:
Create a js script with the following code:

(function (global){
    "use strict";

    const io = require('socket.io-client');

    const socketURL = 'http://10.10.0.82:8000';
    let socket = io.connect(socketURL);

    socket.on('hello', function (){
        console.log("Socket Connected!!")
    });
})(this);

Save it into your scripts folder, then do npm i --save socket.io-client in the scripts folder.

Open a blank project, add an actor, and add a javascript component with the script source file pointing to the js script you created.

Add the plugin to the project folder and the v8 engine and the file links as shown on the project page.

I have been trying to troubleshoot more and so i added this as a script into the Examples directory and am able to use lodash but still can not use Socket.io-client.

Any help would be really appreciated!

@nakosung
Copy link
Collaborator

nakosung commented Apr 5, 2016

Unreal.js is not fully compatible with standard javascript environments(node.js, webbrowsers). So modules which requires built-in functionalities like networking, filesystem, ... may be not working. Instead of using standard web socket libraries, unreal.js has its own web socket library. Unfortunately its api is not compatible with standard one.

Please refer to https://github.com/ncsoft/Unreal.js/wiki/Web-socket

@nakosung nakosung closed this as completed Apr 5, 2016
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