{"id":13607907,"url":"https://github.com/MixinNetwork/kraken","last_synced_at":"2025-04-12T14:31:31.833Z","repository":{"id":40992707,"uuid":"255521122","full_name":"MixinNetwork/kraken","owner":"MixinNetwork","description":"🐙 High performance WebRTC audio SFU implemented with pure Go.","archived":false,"fork":false,"pushed_at":"2025-03-24T09:20:26.000Z","size":265,"stargazers_count":342,"open_issues_count":13,"forks_count":50,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-04-08T15:48:36.943Z","etag":null,"topics":["end-to-end-encryption","sfu","webrtc"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MixinNetwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-14T05:46:28.000Z","updated_at":"2025-04-08T05:52:04.000Z","dependencies_parsed_at":"2024-01-14T04:49:55.544Z","dependency_job_id":"2db7cba3-a132-4c7c-9cdd-e0522d4c3435","html_url":"https://github.com/MixinNetwork/kraken","commit_stats":{"total_commits":140,"total_committers":4,"mean_commits":35.0,"dds":"0.042857142857142816","last_synced_commit":"8576a8dfebe8e6a9ff8240a17a4700412be49c33"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MixinNetwork%2Fkraken","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MixinNetwork%2Fkraken/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MixinNetwork%2Fkraken/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MixinNetwork%2Fkraken/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MixinNetwork","download_url":"https://codeload.github.com/MixinNetwork/kraken/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248581163,"owners_count":21128112,"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":["end-to-end-encryption","sfu","webrtc"],"created_at":"2024-08-01T19:01:22.706Z","updated_at":"2025-04-12T14:31:31.808Z","avatar_url":"https://github.com/MixinNetwork.png","language":"Go","funding_links":[],"categories":["Media API","Projects"],"sub_categories":["WebRTC Server"],"readme":"# Kraken\n\n🐙 High performance WebRTC audio SFU implemented with pure Go.\n\n## Architecture\n\nKraken SFU only supports simple group audio conferencing, more features may be added easily.\n\nBoth Unified Plan and RTCP-MUX supported, so that only one UDP port per participant despite the number of participants in a room.\n\n### monitor [WIP]\n\nThis is the daemon that load balance all engine instances according to their system load, and it will direct all peers in a room to the same engine instance.\n\n### engine\n\nThe engine handles rooms, all peers in a room should connect to the same engine instance. No need to create rooms, a room is just an ID to distribute streams.\n\nAccess the engine with HTTP JSON-RPC, some pseudocode to demonstrate the full procedure.\n\n```javascript\nvar roomId = getUrlQueryParameter('room');\nvar userId = uuidv4();\nvar trackId;\n\nvar pc = new RTCPeerConnection(configuration);\n\n// send ICE candidate to engine\npc.onicecandidate = ({candidate}) =\u003e {\n  rpc('trickle', [roomId, userId, trackId, JSON.stringify(candidate)]);\n};\n\n// play the audio stream when available\npc.ontrack = (event) =\u003e {\n  el = document.createElement(event.track.kind)\n  el.id = aid;\n  el.srcObject = stream;\n  el.autoplay = true;\n  document.getElementById('peers').appendChild(el)\n};\n\n// setup local audio stream from microphone\nconst stream = await navigator.mediaDevices.getUserMedia(constraints);\nstream.getTracks().forEach((track) =\u003e {\n  pc.addTrack(track, stream);\n});\nawait pc.setLocalDescription(await pc.createOffer());\n\n// RPC publish to roomId, with SDP offer\nvar res = await rpc('publish', [roomId, userId, JSON.stringify(pc.localDescription)]);\n// publish should respond an SDP answer\nvar jsep = JSON.parse(res.data.jsep);\nif (jsep.type == 'answer') {\n  await pc.setRemoteDescription(jsep);\n  trackId = res.data.track;\n  subscribe(pc);\n}\n\n// RPC subscribe to roomId periodically\nasync function subscribe(pc) {\n  var res = await rpc('subscribe', [roomId, userId, trackId]);\n  var jsep = JSON.parse(res.data.jsep);\n  if (jsep.type == 'offer') {\n    await pc.setRemoteDescription(jsep);\n    var sdp = await pc.createAnswer();\n    await pc.setLocalDescription(sdp);\n    // RPC anwser the subscribe offer\n    await rpc('answer', [roomId, userId, trackId, JSON.stringify(sdp)]);\n  }\n  setTimeout(function () {\n    subscribe(pc);\n  }, 3000);\n}\n\nasync function rpc(method, params = []) {\n  const response = await fetch('http://localhost:7000', {\n    method: 'POST',\n    mode: 'cors',\n    headers: {\n      'Content-Type': 'application/json'\n    },\n    body: JSON.stringify({id: uuidv4(), method: method, params: params})\n  });\n  return response.json();\n}\n```\n\n## Quick Start\n\nSetup Golang development environment at first.\n\n```\ngit clone https://github.com/MixinNetwork/kraken\ncd kraken \u0026\u0026 go build\n\ncp config/engine.example.toml config/engine.toml\nip address # get your network interface name, edit config/engine.toml\n\n./kraken -c config/engine.toml -s engine\n```\n\nGet the source code of either [kraken.fm](https://github.com/MixinNetwork/kraken.fm) or [Mornin](https://github.com/fox-one/mornin.fm), follow their guides to use your local kraken API.\n\n## Community\n\nKraken is built with [Pion](https://github.com/pion/webrtc), we have discussions over their Slack.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMixinNetwork%2Fkraken","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMixinNetwork%2Fkraken","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMixinNetwork%2Fkraken/lists"}