Skip to content

Instantly share code, notes, and snippets.

View msach22's full-sized avatar

Manik Sachdeva msach22

View GitHub Profile
let videoElement, canvas, ctx, publisher, session, screenElement;
let stopped = false;
const handleError = e => console.log(e);
(async () => {
OT.setLogLevel(5)
session = OT.initSession(API_KEY, SESSION_ID)
try {
stream = await OT.getUserMedia();
const express = require('express');
const axios = require('axios');
const bodyParser = require('body-parser');
const jwt = require('jsonwebtoken');
const { apiKey, apiSecret, sessionId } = require('./config');
const app = express();
app.use(bodyParser.urlencoded({
extended: true,
@msach22
msach22 / python3tls.py
Created July 12, 2018 22:07
If you’re using Python 3.x, run the following snippet to check your environment
import urllib.request
import urllib.error
try:
response = urllib.request.urlopen("https://preview.opentok.com/tls-check.json").read()
print ("Connection successfully established with your current TLS configuration, no further action required")
except urllib.error.URLError:
print ("Failed to connect to OpenTok, please check your system and upgrade your environment as needed.")
@msach22
msach22 / python2tls.py
Created July 12, 2018 22:07
If you’re using Python 2.x, run the following snippet to check your environment
import urllib2
try:
response = urllib2.urlopen("https://preview.opentok.com/tls-check.json").read()
print "Connection successfully established with your current TLS configuration, no further action required"
except urllib2.URLError:
print "Failed to connect to OpenTok, please check your system and upgrade your environment as needed."
@msach22
msach22 / TestTls.java
Created July 12, 2018 22:06
Run the following code to check your environment
import java.net.URL;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.SocketException;
import java.io.IOException;
class TestTls {
public static void main(String[] args){
URL url = null;
try {
@msach22
msach22 / tls.rb
Created July 12, 2018 22:05
Run the following code to check your environment:
require "net/https"
begin
uri = URI('https://preview.opentok.com/tls-check.json')
res = Net::HTTP.get(uri)
puts 'Connection successfully established with your current TLS configuration, no further action required.'
rescue Errno::ECONNRESET => e
puts 'Failed to connect to OpenTok, please check your system and upgrade your environment as needed.'
end
@msach22
msach22 / tls.cs
Created July 12, 2018 22:05
Run the following code to check your environment
using System;
using System.Net;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
WebRequest request = WebRequest.Create(
@msach22
msach22 / tls.php
Created July 12, 2018 22:05
Run the following block of code to test your environment
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'https://preview.opentok.com/tls-check.json',
));
$curlResponse = curl_exec($curl);
if ($curlResponse === false && curl_errno($curl) === 35) {
echo "Failed to connect to OpenTok, please check your system and upgrade your environment as needed.";
} elseif($curlResponse === false){
@msach22
msach22 / tls.js
Created July 12, 2018 22:04
Run the following block of code to test your environment
var https = require("https");
var req = https.request({
host: "preview.opentok.com",
port: "443",
path: "tls-check.json",
method: "GET",
}, function (res) {
res.on("data", function (data) {
console.log("Connection successfully established with your current TLS configuration, no further action required.");
});