Blockcypher Websocket endpoint not working - websocket

I am using the Blockcypher API for test bitcoin transactions and I have troubles with the websocket API endpoint.
When sending the regular ping object after creating a new Websocket it works fine:
this.ws.onopen = () => {
this.ws.send(JSON.stringify({"event": "ping"}))
but when trying to check the confidence of a transaction like this we get an error
this.ws.onopen = () => {
this.ws.send(JSON.stringify({event: 'tx-confidence', address:'<bitcoin address as string>', confidence:0.9}))
Is there anything wrong with the datatypes? Any help would be great!
API reference
Event reference

You probably reached the limit. Consider adding your BlockCypher token at the end of the websocket URL. This was somehow forgotten in the documentation.

Related

intercepting third party calls in Cypress

I am able to use cy.intercept() to intercept a backend API. But this backend API internally makes a call to a third party server. I want to intercept this internal call and stub it, but it's not happening. This internal call cannot be 'seen' in the Network requests of a browser, but it's definitely happening since it's coded in the backend API.
So to summarize, I can intercept a request but not the second request that the first request makes internally. How do I intercept this second internal request?
Many thanks in advance!
You cannot with Cypress commands, they will only work with requests sent from the browser.
Cypress sets up a network proxy in the browser and catch requests made from the app and response back to the browser.
You can add a mock reply to the frontend intercept in order to cut out the backend API altogether.
This makes sense if you are testing the browser app, since you do not care what happens outside browser.
If you also wish to test then backend API, then call it directly (in a different test) and check it's response. See Example API Test
context("GET /users", () => {
it("gets a list of users", () => {
cy.request("GET", "/users").then((response) => {
expect(response.status).to.eq(200)
expect(response.body.results).length.to.be.greaterThan(1)
})
})
})
See the discussion here which asks the same question.

tdlib-ruby Telegram API returns Error timed out

I was trying to set up a web client for telegram using ruby. I registered for telegram application and obtained api_id and api_hash keys. Then I am using tdlib with the help of https://github.com/southbridgeio/tdlib-ruby. Each method call returns promise object and when checked for reason, shows - <TD::Types::Error code=0 message="Timeout error">. I'm not sure what is wrong. Any help would be appreciated.
Had similar problem. You need to connect first. For example:
client = TD::Client.new
client.connect.then do
client.join_chat(chat_id)
end
Or
client = TD::Client.new
client.connect.wait
client.join_chat(chat_id).wait

Connect to socket Qlik Sense Entreprise with EnigmaJS

I build a working mashup on QlikSense Desktop connecting with the usual:
appId = 'engine';
this.session = enigma.create({
schema,
url: 'ws://localhost:4848/app/' + appId
})
But now I uploaded the mashup on the server, and for once, it behaves as expected. It doesn't.
I tried to change it to the following as the server doesn't have SSL certificates.
'ws://domainname:4747/'+appId
But nothing works, any idea ?
(Basically my question is: How can I find my QIX Engine ws url ?)
Whats the error?
But in general, when using QS server you have to be authenticated in order to get some data.
You can check all the received data by listening to all traffic for more details on the error:
session.on('traffic:received', data => console.log('received:', data));
Or you can just "listen" to data related only to authentication by setting a dedicated notification:
session.on('notification:OnAuthenticationInformation', (authInfo) => {
console.log(authInfo)
});
Have a look at Connecting to the Qlik Engine JSON API (scroll down to Qlik Sense Enterprise section) to get the idea what types of authentication are supported

API Gateway WebSocket API postConnection timeout

I'm trying to set up a WebSocket API on API Gateway. I'm following the basic tutorial, and I have everything up and running -> Routes for $connect, $disconnect, "test", $default. I am able to connect to the API, store the connectionId in Redis, and retrieve it when accessing from the test route.
The problem is when I try to send back a message from my lambda (single lambda handling all routes). I'm using the following code
const apigwManagementApi = new AWS.ApiGatewayManagementApi({
apiVersion: '2018-11-29',
endpoint: `https://${event.requestContext.domainName}/${event.requestContext.stage}`
});
Then I call
await apigwManagementApi.postToConnection({
ConnectionId: connectionId,
Data: `Echo: ${data}`
}).promise()
This is only called on the "test" route.
All of this is as per their guide. I had to add a patch to be able to make postConnection work, again, as per their tutorial. The problem is when the above method is called I get a Internal Server Error message from the API Gateway and the lambda times out after 3 seconds.
There is very little info on this method. I'm not sure what is causing the internal server error. I have checked the endpoint and the connectionId, both are correct.
What am I doing wrong? Any suggestions?
So the problem wasn't the actual lambda but the fact that it wasn't set up in a VPC that had access to the Internet. So if you're lambda has VPC enabled, make sure you it has a NAT gateway and Internet gateway set up.

Create function in Parse Cloud Code that does not require authorisation

I have my own instance of Parse Server running on AWS and until now Cloud Functions have been working great, but with one caveat: they cannot be successfully called publicly, i.e. they require an authorisation key be sent in the REST request header.
I want to set up a Slack Slash Command to my server, and it has to be able to POST a payload without any headers or extra parameters. As a result, my requests are currently unauthorised (returning 403 statuses).
Is there a way to create granular control over a Parse Cloud Function's authorisation (i.e. if it requires master-key header or not), and if not — is there a way of forwarding the request but still through the Parse server?—Or even a way of manipulating the headers of a Slack request? I would rather not have to use another service just for request forwarding.
Thanks!
Two options
Pass in the master key on the client request which should bypass authorization. It's a blunt approach but might be okay in your case (without knowing more details).
Or run a new express endpoint alongside parse and from there call the parse cloud function using the masker key.
var api = new ParseServer(...)
var app = express();
app.use('/parse', api);
app.get('/api/slack', function(req, res) {
//call cloud function passing in master key
// add X-Parse-Master-Key as http header
unirest.post("http://myhost.com:1337/parse/functions/mycloudfunction")
.headers({'X-Parse-Master-Key', MASTER_KEY)
.end(function(response) {
}

Resources