How can I send data via Websocket from a VSCode extension - javascript

I would like to send data via Websocket from an VSCode extension. Is there a builtin websocket facility or should I import the package "ws" or else?

used ws package, which sadly is not in ES6 module format but otherwise does its job.

You can use the ws package, here is an example from the official samples repository: https://github.com/microsoft/vscode-extension-samples/blob/main/lsp-log-streaming-sample/client/src/extension.ts

Related

Cant resolve fs, net, tls after mysql installation

I have react-boilerplate application. I want to start using database so I installed:
npm install mysql
npm install mysqljs/mysql
As shown in mysql webpage: https://www.npmjs.com/package/mysql
Now I get errors when I go to localhost in a browser:
Can't resolve 'fs' in '....node_modules\mysql\lib\protocol\sequences'
Can't resolve 'net' in '....node_modules\mysql\lib'
Can't resolve 'tls' in '....node_modules\mysql\lib'
I am using redux-saga combination.
I figured out that I get the error when I write:
const mysql = require('mysql');
in saga.js file
How can I fix these errors?
You can't use a MySQL client library within a browser app.
The errors you're seeing is the client library attempting to require() Node.js standard libraries for file system, network and encryption (TLS) access, which don't exist in the browser.

Creating a react-native app for IOS and I have created a Microsoft SQL server, how to connect these two?

I have an app built on react native and I want to connect to a database that i have made on the Microsoft SQL server. I have searched online and there are things like myssql but I still get errors with that. I followed this tutorial nodejs from the official Microsoft website, and it works with the nodejs and I use node to run it, but how can i use this in my react native project?
You can use AXIOS to make requests to your NodeJS Server
In Android you can access your localhost by the IP 10.0.2.2 (default proxy configured in your Android Virtual Device).
In iOS you can just use localhost
Remember to add the port assigned your NodeJS Server and the
protocol http
Example URL for Android: http://10.0.2.2:3000
You need to write back-end service code.I suggest you to use Asp.Net Web API .You can use Entity Framework.
Also you can use PHP,Java or Python...

Install Twilio onto EC2 RHEL instance

I was wondering how I install Twilio onto my RHEL EC2 instance. I have already tried, and this is what happened:
Naturally, I decided to search for the package instead. This time, I realized that I could not find anything named Twilio:
How should I go about installing Twilio onto my EC2 instance? Thanks in advance for all the help.
Jack
Twilio is a communications service. You do not install it.
If you are developing applications that use Twilio, then you would install the application and the Twilio SDK for the language that you are using.
Here is a link to the Twilio Libraries (SDKs):
Server-Side SDKs
If you are looking to install the Twilio Client for VOIP:
THE TWILIO.JS LIBRARY: TWILIO IN THE BROWSER

Accessing Rest API for kafka schema registry using server on same domain

I have kafka set up on my machine with schema registry enabled.
I am also writing a Flask application on my same machine.
I need to access the Rest API i.e.
localhost:8081/schemas/ids/1
From
localhost:5000
How do I achieve this?
I am using latest version of kafka and schema registry.. and have tried using JavaScript CORS request
EDIT
Here is the properties file
Here is the code
Here is the error
Here is the logs
Add the following config parameters to your etc/schema-registry/schema-registry.properties file to enable CORS
access.control.allow.methods=GET,POST,PUT,OPTIONS
access.control.allow.origin=*
Full documentation for config params is here http://docs.confluent.io/current/schema-registry/docs/config.html

Kurento Media Server HelloWorld Javascript example webSocket error

Merry Christmas!
I am trying to configure KMS on my Ubuntu 14.04 (64 bit). I could install the KMS server successfully following the guide at https://www.kurento.org/docs/6.0.0/installation_guide.html.
Also, downloaded the Javascript HelloWorld tutorial from https://www.kurento.org/docs/6.0.0/tutorials/js/tutorial-1-helloworld.html. I could run the example successfully on localhost on Google Chrome Version 47.0.2526.106 (64-bit) on the same Ubuntu System.
But, I could not see the local video nor the loop backed video. Only a spinner icon is shown on both the Video placeholders. Consulting the Console log reveals a problem after creating the SDP offer. The error is as described below.
kurento-client.js:21072 WebSocket connection to 'wss://127.0.0.1:8433/kurento' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
I am no expert on web sockets and stuff. Any help on this would really help me to proceed forward.
Note: I am running the example on HTTP, not on HTTPS. I guess that would not be the cause of the problem, though.
Regards,
LazyCoder7
I managed to solve it. I was wrong on my guess though, HTTPS was indeed required in order to make the WebSocket connection ( i was not aware of that part ). Created a certificate file (.pem) (from crt and key file already in the helloworld folder) and configured the KMS server to use the certificate. After this I was able to see myself and the same me in loopback :)
You are following an old version of the documentation. Since Chrome 47, in is mandatory to server pages through HTTPS if you want to use the getUserMedia APi. So we updated all our tutorials, and they now have a self-signed certificate. In case of the JS tutorials, you also need to configure KMS to expose a secure WS signalling connection, as the browser directly connects to the media server to control it.
Please follow the latest version of the documentation here
Be sure that the KMS is running on the port 8433 (not 8888), if you are using docker
docker run -d --name kms -p 8433:8433 kurento/kurento-media-server:trusty-latest

Categories