{"id":23651479,"url":"https://github.com/athanclark/purescript-websockets-rpc","last_synced_at":"2025-11-15T17:30:16.799Z","repository":{"id":58224336,"uuid":"84154912","full_name":"athanclark/purescript-websockets-rpc","owner":"athanclark","description":"A simple subscription-esque RPC mechanism using WebSockets, ala the haskell websockets-rpc library (client only)","archived":false,"fork":false,"pushed_at":"2017-06-11T16:45:19.000Z","size":58,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-28T17:09:00.624Z","etag":null,"topics":["purescript","websockets","websockets-rpc"],"latest_commit_sha":null,"homepage":null,"language":"PureScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/athanclark.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-03-07T04:32:42.000Z","updated_at":"2020-06-05T14:17:29.000Z","dependencies_parsed_at":"2022-08-31T02:00:54.385Z","dependency_job_id":null,"html_url":"https://github.com/athanclark/purescript-websockets-rpc","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athanclark%2Fpurescript-websockets-rpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athanclark%2Fpurescript-websockets-rpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athanclark%2Fpurescript-websockets-rpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athanclark%2Fpurescript-websockets-rpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/athanclark","download_url":"https://codeload.github.com/athanclark/purescript-websockets-rpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239609703,"owners_count":19667999,"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":["purescript","websockets","websockets-rpc"],"created_at":"2024-12-28T16:37:54.521Z","updated_at":"2025-11-15T17:30:16.713Z","avatar_url":"https://github.com/athanclark.png","language":"PureScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"purescript-websockets-rpc\n=======================\n\n\nfor use with a [websockets-rpc](https://hackage.haskell.org/package/websockets-rpc)-compliant websocket server,\nthe [purescript-websocket-moderate](https://pursuit.purescript.org/packages/purescript-websocket-moderate) client\nlibrary, and [purescript-argonaut](https://github.com/purescript-contrib/purescript-argonaut) json serialization\nsystem.\n\n\nExample\n-------\n\n\n```purescript\nimport WebSocket.RPC\nimport WebSocket (WEBSOCKET)\n\ndata MySubDSL = Foo\n  deriving (EncodeJson, DecodeJson) -- you should figure this out\n\ndata MySupDSL = Bar\n  deriving (EncodeJson, DecodeJson)\n\ndata MyRepDSL = Baz\n  deriving (EncodeJson, DecodeJson)\n\ndata MyComDSL = Qux\n  deriving (EncodeJson, DecodeJson)\n\n\n\nmyClient :: forall eff\n          . {url :: String, protocols :: Array String}\n         -\u003e (WebSocketClientRPCT MyRepDSL MyComDSL (Eff _) Unit\nmyClient = rpcClient $ \\dispatch -\u003e do\n  -- could dispatch more than one subscription here\n  dispatch myClient'\n  where\n    myClient' :: RPCClient MySubDSL MySupDSL MyRepDSL MyComDSL (Eff (AllEffs eff))\n    myClient' =\n      { subscription: Foo\n      , onReply: \\{supply,cancel} Baz -\u003e do\n          x \u003c- randomInt 1 10\n          if x == 10 then cancel else supply Bar\n      , onComplete: \\Qux -\u003e\n          log \"ayooo\"\n      }\n      \n      \nmain :: Eff _ Unit\nmain =\n  execWebSocketClientRPCT $ myClient {url: \"ws://localhost\", protocols: []}\n```\n\nsee the `example/` folder for a working one\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fathanclark%2Fpurescript-websockets-rpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fathanclark%2Fpurescript-websockets-rpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fathanclark%2Fpurescript-websockets-rpc/lists"}