Skip to content

Instantly share code, notes, and snippets.

// Gist for https://medium.com/@ebakhtarov/bidirectional-websockets-with-redux-saga
import { eventChannel } from "redux-saga";
import { all, call, put, take, select, race } from "redux-saga/effects";
import { actionTypes } from "./constants";
function watchMessages(socket) {
return eventChannel(emit => {
/* eslint-disable no-param-reassign */
@ebachter
ebachter / iframe_handling_in_react.js
Last active October 6, 2019 10:58
iframe handling in react
import React from 'react';
import { connect } from 'react-redux';
class PageWidget extends React.Component {
componentDidMount() {
this.ifr.onload = () => {
this.ifr.contentWindow.postMessage('hello', '*');
};
window.addEventListener("message", this.handleFrameTasks);
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Solution</title>
</head>
<body>
<article></article>
<section id="result">
<ol></ol>
-- Function: public.delete_cunit(text, integer)
-- DROP FUNCTION public.delete_cunit(text, integer);
CREATE OR REPLACE FUNCTION public.delete_cunit(
IN cunit text,
IN modelid integer,
OUT x text,
OUT tt text,
OUT tt2 text)
cameras[cam].liveffmpeg = child_process.spawn("ffmpeg", [
"-rtsp_transport", "tcp", //"udp"
"-i", "rtsp://root:qwer@192.168.178.36:554/mpeg4/media.amp", //cameras[cam].rtsp,
"-vcodec", "libx264",
"-c:v", "libvpx",
"-s", "320x240",
"-r", "10",
"-f","ffm",
"-an",
"http://mediain.example.com:8090/v1/user742/secret"
var net = require('net');
var server = net.createServer(function(socket) {
console.log('CONNECTED: ' + socket.remoteAddress +':'+ socket.remotePort);
startPyScript()
//console.log(socket);
// incoming messages from clients.
socket.on('data', function (data) {
//console.log(data.toString('utf8'));