Skip to content

Instantly share code, notes, and snippets.

<?php
namespace Library\WebsocketWeb;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
use Library\WebsocketWeb\Channel\Chat;
use Library\WebsocketWeb\Channel\ChatBattle;
use Library\WebsocketWeb\Channel\Notice;
use Library\WebsocketWeb\Logger;
use React\EventLoop\LoopInterface;
<?php
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use Library\WebsocketWeb\Socket;
use Phalcon\CLI\Task;
use React\EventLoop\StreamSelectLoop;
use Predis\Async\Client as PredisClient;
use React\Socket\Server as ReactSocket;
@Zazza
Zazza / ParseJson.js
Last active February 14, 2021 14:02
ParseJson with anonymous func + yield
function parseObject(obj) {
let result = []
let pathesArray = function* inObject(obj, path) {
for(let item in obj) {
let currentPath = path + '.' + item
if (path === '')
currentPath = item
if (!Array.isArray(obj[item])) {
@Zazza
Zazza / parseJson.js
Created February 14, 2021 06:36
JS class ParseJSon
'use strict';
class ParseJson {
obj = {}
result = []
constructor(obj) {
this.obj = JSON.parse(obj)
}