{"id":22329097,"url":"https://github.com/realtime-framework/realtimerxjs","last_synced_at":"2025-03-26T06:42:03.941Z","repository":{"id":57348918,"uuid":"79366702","full_name":"realtime-framework/RealtimeRxJS","owner":"realtime-framework","description":"Realtime Messaging SDK for JavaScript Reactive Extensions (RxJS)","archived":false,"fork":false,"pushed_at":"2017-01-24T11:34:40.000Z","size":1047,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-04T06:02:43.903Z","etag":null,"topics":["realtime-messaging","rxjs","rxjs-observables","websockets"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/realtime-framework.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}},"created_at":"2017-01-18T17:47:41.000Z","updated_at":"2018-03-11T09:12:02.000Z","dependencies_parsed_at":"2022-08-24T18:00:54.678Z","dependency_job_id":null,"html_url":"https://github.com/realtime-framework/RealtimeRxJS","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realtime-framework%2FRealtimeRxJS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realtime-framework%2FRealtimeRxJS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realtime-framework%2FRealtimeRxJS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realtime-framework%2FRealtimeRxJS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/realtime-framework","download_url":"https://codeload.github.com/realtime-framework/RealtimeRxJS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245605709,"owners_count":20643030,"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":["realtime-messaging","rxjs","rxjs-observables","websockets"],"created_at":"2024-12-04T03:14:29.216Z","updated_at":"2025-03-26T06:42:03.919Z","avatar_url":"https://github.com/realtime-framework.png","language":"TypeScript","readme":"# Realtime Messaging SDK for JavaScript Reactive Extensions (RxJS)\nPart of the [The Realtime® Framework](http://framework.realtime.co), Realtime Cloud Messaging (aka ORTC) is a secure, fast and highly scalable cloud-hosted Pub/Sub real-time message broker for web and mobile apps.\n\nIf your application has data that needs to be updated in the user’s interface as it changes (e.g. real-time stock quotes or ever changing social news feed) Realtime Cloud Messaging is the reliable, easy, unbelievably fast, “works everywhere” solution.\n\n# Overview\nThis project provides Reactive Extensions for JavaScript ([RxJS](https://github.com/ReactiveX/rxjs)) bindings for the Realtime Messaging JavaScript SDK, allowing easy channel subscription as Rx Observables.\n\nThis project can be easily used within Angular2 and Ionic2 apps.\n\n# Installing with NPM\n\n```bash\nnpm install realtime-rxjs --save\n```\n\n# Usage example\n\n\n```javascript\nimport * as RealtimeRx from 'realtime-rxjs';\nimport { Observable } from 'rxjs/Rx';\n...\n// Instantiates a new Realtime client connection\nconst rxConnection = new RealtimeRx.ObservableConnection();\n\n// Sets the connection metadata (optional)\nrxConnection.setConnectionMetadata(\"Realtime RxJs example\");\n\n// Establishes the connection to the Realtime server\nrxConnection.connect(\"YOUR_APP_KEY\", \"token\");\n\n// Observe channel and subscribe to receive messages\nrxConnection.observeChannel(\"myChannel\")\n  .subscribe((message) =\u003e {\n    console.log(\"Received message: \" + message);\n  });\n  \n// Send a message\nrxConnection.send(\"myChannel\", \"This is the message ...\");\n\n```\nNote that you don't need to manage the connection state yourself (e.g. waiting for the onConnected event before subscribing a channekl) as it's performed internally (subscriptions and sends will be pending until the underlying Realtime connection is ready).\n\n# API Reference\n\n## connect(appkey: string, token: string): void\nEstablishes a connection to a Realtime server using the given appkey and security token.\n\n```\nrxConnection.connect(\"YOUR_APP_KEY\", \"token\");\n```\n\n## observeConnection(): Observable\u0026lt;ConnectionEvent\u003e\nReturns an Observable of connection events (e.g. onSubscribed, onReconneting, ...).\n\n```\nrxConnection.observeConnection()\n\t.subscribe((event) =\u003e {\n      console.log(\"Realtime connection event:\", event);\n    });\n```\n## observeChannel(channel: string): Observable\u0026lt;string\u003e\nReturns an Observable for a Realtime channel. Each message received on the channel will emit a next event for each subscribed observer.\n\n```\nrxConnection.observeChannel(\"myChannel\")\n  .subscribe((message) =\u003e {\n    console.log(\"Received message: \" + message);\n  });\n``` \n\nNote: the underlying Realtime channel unsubscription is performed automatically when there are no more observers subscribing the channel.\n\n## observeChannelWithOptions(channel: string, subscriberId?: string, filter?: string, autoUnsubscribe?: boolean): Observable\u0026lt;MessageOptions\u003e\nSame as `observeChannel` but uses other subscription options like buffered messages and filters.\n\n```\nrxConnection.observeChannelWithOptions(\"myChannel\", \"mySubscriberId\")\n\t.subscribe((m) =\u003e {\n    \tconsole.log(\"Received message: \" + m.message);\n    \tconsole.log(\"Message id: \" + m.seqId);\n    });\n``` \n\nThe default unsubscribe behaviour is the same as observeChannel (unsubscribe from the channel when there no more active channel observers), but passing `autoUnsubscribe = false` will not perform unsubscribes at all (useful for buffered subscriptions).\n\n## send(channel: string, message: string): void\nSends a message to the given channel using the \"at-most-once\" delivery contract.\n\n```\nrxConnection.send(\"myChannel\", JSON.stringify({ foo: \"bar\" }));\n```\n\n## publish(channel: string, message: string, ttl: number): Observable\u0026lt;string\u003e\nPublishes a message to the given channel using the \"at-least-once\" delivery contract.\n\n```\nrxConnection.publish(\"myChannel\", JSON.stringify({ foo: \"bar\" }), 60)\n\t.subscribe((seqId) =\u003e {\n    \tconsole.log(\"Message published with seqId: \" + seqId);\n    },\n    (error) =\u003e console.log(\"Error publishing: \" + error));\n```\n\n*Note: Don't forget to subscribe to get the publish result otherwise the message publish won't be performed at all.*\n \n## disconnect(): void\nDisconnects from the Realtime server. \n\n```\nrxConnection.disconnect();\n```\n\n\n## Other methods \nThis project wraps all public methods of the underlying Realtime JavaScript SDK. Complete reference can be found at\n[http://messaging-public.realtime.co/documentation/javascript/2.1.0/OrtcClient.html](http://messaging-public.realtime.co/documentation/javascript/2.1.0/OrtcClient.html)\n\n\n## Authors\nRealtime.co\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealtime-framework%2Frealtimerxjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frealtime-framework%2Frealtimerxjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealtime-framework%2Frealtimerxjs/lists"}