{"id":20696158,"url":"https://github.com/mirek/quartzcomposer-websocket","last_synced_at":"2025-04-22T20:42:44.932Z","repository":{"id":1449184,"uuid":"1681149","full_name":"mirek/quartzcomposer-websocket","owner":"mirek","description":"Quartz Composer WebSocket Plug-In","archived":false,"fork":false,"pushed_at":"2021-12-21T22:07:00.000Z","size":268,"stargazers_count":40,"open_issues_count":5,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T18:41:28.174Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://github.com/mirek/quartzcomposer-websocket","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mirek.png","metadata":{"files":{"readme":"Readme.mkdn","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-04-29T15:21:55.000Z","updated_at":"2024-10-16T23:13:32.000Z","dependencies_parsed_at":"2022-08-16T13:20:41.798Z","dependency_job_id":null,"html_url":"https://github.com/mirek/quartzcomposer-websocket","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirek%2Fquartzcomposer-websocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirek%2Fquartzcomposer-websocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirek%2Fquartzcomposer-websocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirek%2Fquartzcomposer-websocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mirek","download_url":"https://codeload.github.com/mirek/quartzcomposer-websocket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250320655,"owners_count":21411412,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T00:12:46.599Z","updated_at":"2025-04-22T20:42:44.915Z","avatar_url":"https://github.com/mirek.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Quartz Composer WebSocket Plug-In\n\nWebSocket Patch enables low-latency, bi-directional, full-duplex communication with web browsers - Firefox 4, Google Chrome 4, Opera 11 and Apple Safari 5 (including iOS Safari) as well as Adobe Flash/Flex/AIR applications.\n\nThe patch acts as a server listening on specified TCP port (default 60001).\n\nTo make connection to the patch you could use the following JavaScript code:\n\n    \u003c!DOCTYPE html\u003e\n    \u003chtml\u003e\n      \u003chead\u003e\n        \u003cmeta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\"\u003e\n        \u003cscript type=\"text/javascript\" charset=\"utf-8\"\u003e\n      \n          // WebSocket\n          var ws = null;\n      \n          // When the page is loaded...\n          window.addEventListener('load', function(e) {\n        \n            // Check if the browser supports WebSockets...\n            if (\"WebSocket\" in window) {\n          \n              // ...it does, let's connect to localhost default port.\n              // Make sure Quartz Composer composition is running with\n              // the WebSocket Patch set to port 60001. \n              ws = new WebSocket('ws://localhost:60001');\n            \n              // Invoked when there was an error with the connection. \n              ws.onerror = function(e) {\n                console.log('error', e);\n              }\n            \n              // Invoked when the socket has been opened successfully.\n              ws.onopen = function(e) {\n                console.log('open', e);\n              }\n            \n              // Callback invoked when incoming messages arrive. Event `data` attribute\n              // holds the string passed. WebSocket in current spec supports utf8 text-based\n              // communication only. Binary data  is base64 encoded.\n              ws.onmessage = function(e) {\n                var json = JSON.parse(e.data);\n                console.log('message', json);\n              }\n            \n              // Invoked when the socket has been closed\n              ws.onclose = function(e) {\n                console.log('close', e);\n              }\n            \n            } else {\n          \n              // ...seems like the web browser doesn't support WebSockets.\n              alert('WebSocket not supported by your browser, use Safari, Chrome or Firefox');\n            \n            }\n          }, false);\n        \n        \u003c/script\u003e\n      \u003c/head\u003e\n    \u003c/html\u003e\n\nMessages are JSON encoded into tuples `[name, value]`. Example messages:\n\n    // Number input port\n    ['/foo/bar', 3.14]\n  \n    // Boolean\n    ['/my/toggle', true]\n  \n    // Array\n    ['/foo/numbers', [1, 3, 5, 7, 11]]\n  \n    // Structure\n    ['/structure', { 'foo': 'bar' }]\n  \n    // Image\n    ['/foo/bar', 'R0lGODlhDwAPALMAAAAAAL+/v///AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAEALAAAAAAPAA8AAAQ0MEgJap04VMH5xUAnelM4jgAlmOtqpqzlxewpbjZa565nvxrfjRScyYjFXwbX+WQ0lhQmAgA7']\n\nIn order to send values from web page to Quartz Composer, in JavaScript JSON encode the tuple, ie:\n\n    var value = 3.14;\n    ws.send( JSON.stringify(['/foo/bar', value]) );\n\nIf the WebSocket Patch has `foo/bar` output port defined with Number format, the value will arrive to Quartz Composer for further processing.\n\n## Installation\n\n    # Clone the repository including all submodules\n    git clone --recursive git://github.com/mirek/quartzcomposer-websocket.git\n    \n    # Build the plugin and install in ~/Library/Graphics/Quartz Composer Plug-Ins/WebSocket.plugin\n    cd quartzcomposer-websocket\n    xcodebuild clean install\n    \n    # Open example composition and run it\n    open Compositions/Example.qtz\n    \n    # Open example web page\n    open WebPages/example.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirek%2Fquartzcomposer-websocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmirek%2Fquartzcomposer-websocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirek%2Fquartzcomposer-websocket/lists"}