SOLVED Minimum needed for a successful websocket connection?

Pfap

Member
I am trying to get confirmation that I can connect to a Node server, from an HTML5 instance of GameMaker running in the browser.

Here is my Node.js code:
Code:
const WebSocket = require('ws');
const wss = new WebSocket.Server({ port: 8080 });
wss.on('connection', function connection(ws) {
    console.log("client connected!")
  ws.on('message', function incoming(message) {
    console.log('received: %s', message);
  });
  ws.send('something');
});
and my GML, this is in an objects Create event and is the only object in the room:


Code:
network_set_config(network_config_connect_timeout, 1000);
network_set_config(network_config_use_non_blocking_socket, 1);

client = network_create_socket(network_socket_ws);
//network_connect_raw(client, "127.0.0.1", 8080);
network_connect_raw(client, "ws://localhost", 8080);

The browser console is only giving me: Error: function network_connect_raw()

I'm mainly looking to get the console.log() to fire from my Node process...
Does anybody have any ideas what I am doing wrong?
 
Last edited:
Top