Author Topic: API Issue  (Read 3793 times)

0 Members and 2 Guests are viewing this topic.

xmystico

  • Youngling
  • *
  • Posts: 9
  • Karma: +1/-0
    • View Profile
API Issue
« on: April 11, 2015, 03:22:12 AM »
Hi there,

I'm trying to develop using the deepbot websocket connection,
i've tried numerous ways, however despite sending the registration request to the websocket server, i cant get a reply back


TheNumbLock

  • Advisor
  • Councilor
  • **
  • Posts: 4776
  • Karma: +137/-5
    • View Profile
  • Twitch Name: TheNumbLock
Re: API Issue
« Reply #1 on: April 11, 2015, 03:25:28 AM »
You are using this right? https://github.com/DeepBot-API/client-websocket

You setup your API secret?
Old Name: RepentGamingTV
Twitch: Here

Need help ASAP?
Join Deepbot's Discord: Discord.Deepbot.tv
Deepbot's Twitter: @DeepSupport

xmystico

  • Youngling
  • *
  • Posts: 9
  • Karma: +1/-0
    • View Profile
Re: API Issue
« Reply #2 on: April 11, 2015, 03:26:16 AM »
I'm using the method - ive checked the ports open via netstat - im using the api key - however nothing seems to work

xmystico

  • Youngling
  • *
  • Posts: 9
  • Karma: +1/-0
    • View Profile
Re: API Issue
« Reply #3 on: April 11, 2015, 08:58:48 PM »
My current connection node code
Code: [Select]
var net = require('net');
var client = new net.Socket();
 
client.connect(3337, '127.0.0.1', function() {
console.log('Connected to server..');
client.write('api|register|{APIKEY}');
});
 
client.on('data', function(data) {
console.log('Received: ' + data);
client.destroy();
});
 
client.on('close', function() {
console.log('Connection closed');
});



« Last Edit: April 11, 2015, 09:04:32 PM by xmystico »

TheNumbLock

  • Advisor
  • Councilor
  • **
  • Posts: 4776
  • Karma: +137/-5
    • View Profile
  • Twitch Name: TheNumbLock
Re: API Issue
« Reply #4 on: April 12, 2015, 01:06:39 AM »
Where it says {APIKEY} I am assuming you put your API key there.
Old Name: RepentGamingTV
Twitch: Here

Need help ASAP?
Join Deepbot's Discord: Discord.Deepbot.tv
Deepbot's Twitter: @DeepSupport

xmystico

  • Youngling
  • *
  • Posts: 9
  • Karma: +1/-0
    • View Profile
Re: API Issue
« Reply #5 on: April 12, 2015, 01:11:38 AM »
Yeah i added my API key there,
i've also tried with several different packages, combinations of with/without {}

it connects - i send the registration request, server doesn't reply

Deepbot is running in admin mode
I've changed the api key several times - restarted bot / system - everything i can think of

ExpertsOnline

  • Creator
  • Councilor
  • *****
  • Posts: 2656
  • Karma: +289/-24
    • View Profile
  • Twitch Name: expertsonline
Re: API Issue
« Reply #6 on: April 23, 2015, 12:22:35 AM »
I have not used the net module before - just wrote this test script and it worked with websockets....so perhaps try this?

Code: [Select]
var WebSocket = require('ws');
var ws = new WebSocket('ws://localhost:3337/');
ws.on('open', function() {
    console.log('sending API registration');
    ws.send('api|register|EE3A7DJQOMKJFBBHGPdZafNWKbTIHBBadQECT');
});

ws.on('close', function close() {
  console.log('disconnected');
});
ws.on('message', function(message) {
    console.log('Received: ' + message);
});