In this article I want to show you how to connect to the websockets of Steem via Autoit.
At the First you most download the 3 UDF´s from my Github Project Websocket
Create a Folder and Move the files to it:
like this:
now we create a new au3 file and open it.
we write now in the first 2 line´s:
#include <WinHttp.au3>
#include <JSON.au3>
Now we have to start a session and establish a connection.
for this step we wirte now this:
$hSession = _WinHttpOpen()
$hConnect = _WinHttpConnect($hSession, "gtg.steem.house",8090)
now we can send the Command to the websocket:
$name = "killerfreak"
$sPost = _WinHttpSimpleSSLRequest($hConnect, "POST", "", "", '{"jsonrpc": "2.0","id": 7, "method": "get_accounts", "params": [["'&$name&'"]]}')
at last we write now the Output to see the Result and close the Handle
MsgBox(0,"Output",$sPost)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hSession)
Result:
i you want see the Result in a Array you must include the array.au3
for this write under the
#include <JSON.au3>
this
#include <Array.au3>
now you can write the script so:
#include <WinHttp.au3>
#include <JSON.au3>
#include <Array.au3>
$hSession = _WinHttpOpen()
$hConnect = _WinHttpConnect($hSession, "gtg.steem.house",8090)
$name = "killerfreak"
$sPost = _WinHttpSimpleSSLRequest($hConnect, "POST", "", "", '{"jsonrpc": "2.0","id": 7, "method": "get_accounts", "params": [["'&$name&'"]]}')
$t = _JSONDecode($sPost)
$sPostResult = $t[2][1]
_ArrayDisplay($sPostResult[0])
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hSession)
now show the Result better^^
Complet Script:
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.14.2
Author: Killerfreak
Script Function:
Connect to a Steem Websocket
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
#include <WinHttp.au3>
#include <JSON.au3>
#include <Array.au3>
$hSession = _WinHttpOpen()
$hConnect = _WinHttpConnect($hSession, "gtg.steem.house",8090)
$name = "killerfreak"
$sPost = _WinHttpSimpleSSLRequest($hConnect, "POST", "", "", '{"jsonrpc": "2.0","id": 7, "method": "get_accounts", "params": [["'&$name&'"]]}')
$t = _JSONDecode($sPost)
$spostresult = $t[2][1]
_ArrayDisplay($spostresult[0])
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hSession)
At the moment i work at a UDF for the websocket.
I Hope you enjoy this Tutorial
Posted on Utopian.io - Rewarding Open Source Contributors
Your contribution cannot be approved because it does not refer to or relate to an open-source repository. See here for a definition of "open-source."
Hi, these are the reasons your contribution was rejected
I recommend you read the rules before contributing again in the future.
You can contact us on Discord.
[utopian-moderator]
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
You got a 16.61% upvote from @upboater courtesy of @killerfreak!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit