{"action":"created","comment":{"url":"https://api.github.com/repos/reflex-frp/reflex-examples/pulls/comments/236886335","pull_request_review_id":179058379,"id":236886335,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNjg4NjMzNQ==","diff_hunk":"@@ -0,0 +1,130 @@\n+{-# LANGUAGE OverloadedStrings #-}\n+{-# LANGUAGE RankNTypes        #-}\n+{-# LANGUAGE RecursiveDo       #-}\n+{-# LANGUAGE LambdaCase        #-}\n+{-# LANGUAGE ScopedTypeVariables #-}\n+\n+module Frontend.Examples.WebSocketChat.Main where\n+\n+import           Data.Aeson         (encode,decode)\n+import           Data.ByteString    as B\n+import           Data.ByteString.Lazy (toStrict, fromStrict)\n+import           Data.Monoid        ((<>))\n+import qualified Data.Text          as T\n+import           Data.Text (Text)\n+import           GHCJS.DOM.HTMLElement       (focus)\n+import           Language.Javascript.JSaddle\n+import           Reflex\n+import           Reflex.Dom         hiding (mainWidget)\n+import           Reflex.Dom.Core    (mainWidget)\n+import           Control.Monad.Fix (MonadFix)\n+import           Control.Monad      (void)\n+\n+--------------------------------------------------------------------------------\n+import           Common.Examples.WebSocketChat.Message\n+--------------------------------------------------------------------------------\n+\n+main :: IO ()\n+main = run $ mainWidget app\n+\n+--------------------------------------------------------------------------------\n+\n+-- TODO\n+--  - factor out the performEvents (see keyboard -example)\n+--  - factor out the message forming\n+--  - factor out the textInput-button combos\n+--  - add close connection button and associated message handling\n+app\n+  :: ( DomBuilder t m\n+     , MonadFix m\n+     , MonadHold t m\n+     , PostBuild t m\n+     , PerformEvent t m\n+     , TriggerEvent t m\n+     , Prerender js m\n+     )\n+  => m ()\n+app = do\n+  rec\n+    msgEvDyn <- widgetHold loginWidget (messagingWidget <$ loggedInEv)\n+    let\n+      msgSendEv = switch (current msgEvDyn)\n+      msgRecEv = fmapMaybe decodeOneMsg wsRespEv\n+      eRecRespTxt = fmap showMsg msgRecEv\n+      loggedInEv = fmapMaybe loginEv msgRecEv\n+    wsRespEv <- prerender (return never) $ do\n+      let sendEv = fmap ((:[]) . toStrict . encode) msgSendEv\n+      ws <- webSocket \"ws://localhost:8000/websocketchat\" $ def & webSocketConfig_send .~ sendEv","path":"frontend/src/Frontend/Examples/WebSocketChat/Main.hs","position":57,"original_position":57,"commit_id":"bf5a55ac0e95ad4b7a95ee9c0343c667427ad6f7","original_commit_id":"693b097ac1f15d0a35ac022b9e591fbcc1386b25","user":{"login":"dfordivam","id":681060,"node_id":"MDQ6VXNlcjY4MTA2MA==","avatar_url":"https://avatars3.githubusercontent.com/u/681060?v=4","gravatar_id":"","url":"https://api.github.com/users/dfordivam","html_url":"https://github.com/dfordivam","followers_url":"https://api.github.com/users/dfordivam/followers","following_url":"https://api.github.com/users/dfordivam/following{/other_user}","gists_url":"https://api.github.com/users/dfordivam/gists{/gist_id}","starred_url":"https://api.github.com/users/dfordivam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dfordivam/subscriptions","organizations_url":"https://api.github.com/users/dfordivam/orgs","repos_url":"https://api.github.com/users/dfordivam/repos","events_url":"https://api.github.com/users/dfordivam/events{/privacy}","received_events_url":"https://api.github.com/users/dfordivam/received_events","type":"User","site_admin":false},"body":"But still this is not really complete, @luigy is it possible to get the `websocketchat` part also from the `BackendRoute` ?","created_at":"2018-11-27T23:19:24Z","updated_at":"2018-11-27T23:19:24Z","html_url":"https://github.com/reflex-frp/reflex-examples/pull/17#discussion_r236886335","pull_request_url":"https://api.github.com/repos/reflex-frp/reflex-examples/pulls/17","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/reflex-frp/reflex-examples/pulls/comments/236886335"},"html":{"href":"https://github.com/reflex-frp/reflex-examples/pull/17#discussion_r236886335"},"pull_request":{"href":"https://api.github.com/repos/reflex-frp/reflex-examples/pulls/17"}},"in_reply_to_id":233332110},"pull_request":{"url":"https://api.github.com/repos/reflex-frp/reflex-examples/pulls/17","id":230610679,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwNjEwNjc5","html_url":"https://github.com/reflex-frp/reflex-examples/pull/17","diff_url":"https://github.com/reflex-frp/reflex-examples/pull/17.diff","patch_url":"https://github.com/reflex-frp/reflex-examples/pull/17.patch","issue_url":"https://api.github.com/repos/reflex-frp/reflex-examples/issues/17","number":17,"state":"open","locked":false,"title":"Use Obelisk for running reflex-examples.","user":{"login":"dfordivam","id":681060,"node_id":"MDQ6VXNlcjY4MTA2MA==","avatar_url":"https://avatars3.githubusercontent.com/u/681060?v=4","gravatar_id":"","url":"https://api.github.com/users/dfordivam","html_url":"https://github.com/dfordivam","followers_url":"https://api.github.com/users/dfordivam/followers","following_url":"https://api.github.com/users/dfordivam/following{/other_user}","gists_url":"https://api.github.com/users/dfordivam/gists{/gist_id}","starred_url":"https://api.github.com/users/dfordivam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dfordivam/subscriptions","organizations_url":"https://api.github.com/users/dfordivam/orgs","repos_url":"https://api.github.com/users/dfordivam/repos","events_url":"https://api.github.com/users/dfordivam/events{/privacy}","received_events_url":"https://api.github.com/users/dfordivam/received_events","type":"User","site_admin":false},"body":"I have tried to model it in such a way that this can be integrated in reflex-frp.org as well.\r\n\r\nPreview \r\n![image](https://user-images.githubusercontent.com/681060/48440348-03ecdf00-e7cc-11e8-8a1c-54844e997694.png)\r\n","created_at":"2018-11-13T20:16:11Z","updated_at":"2018-11-27T23:19:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"20f73a6648032c24637d8cb5bf56f2e2ced6ad55","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/reflex-frp/reflex-examples/pulls/17/commits","review_comments_url":"https://api.github.com/repos/reflex-frp/reflex-examples/pulls/17/comments","review_comment_url":"https://api.github.com/repos/reflex-frp/reflex-examples/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reflex-frp/reflex-examples/issues/17/comments","statuses_url":"https://api.github.com/repos/reflex-frp/reflex-examples/statuses/bf5a55ac0e95ad4b7a95ee9c0343c667427ad6f7","head":{"label":"dfordivam:master","ref":"master","sha":"bf5a55ac0e95ad4b7a95ee9c0343c667427ad6f7","user":{"login":"dfordivam","id":681060,"node_id":"MDQ6VXNlcjY4MTA2MA==","avatar_url":"https://avatars3.githubusercontent.com/u/681060?v=4","gravatar_id":"","url":"https://api.github.com/users/dfordivam","html_url":"https://github.com/dfordivam","followers_url":"https://api.github.com/users/dfordivam/followers","following_url":"https://api.github.com/users/dfordivam/following{/other_user}","gists_url":"https://api.github.com/users/dfordivam/gists{/gist_id}","starred_url":"https://api.github.com/users/dfordivam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dfordivam/subscriptions","organizations_url":"https://api.github.com/users/dfordivam/orgs","repos_url":"https://api.github.com/users/dfordivam/repos","events_url":"https://api.github.com/users/dfordivam/events{/privacy}","received_events_url":"https://api.github.com/users/dfordivam/received_events","type":"User","site_admin":false},"repo":{"id":156845225,"node_id":"MDEwOlJlcG9zaXRvcnkxNTY4NDUyMjU=","name":"reflex-examples","full_name":"dfordivam/reflex-examples","private":false,"owner":{"login":"dfordivam","id":681060,"node_id":"MDQ6VXNlcjY4MTA2MA==","avatar_url":"https://avatars3.githubusercontent.com/u/681060?v=4","gravatar_id":"","url":"https://api.github.com/users/dfordivam","html_url":"https://github.com/dfordivam","followers_url":"https://api.github.com/users/dfordivam/followers","following_url":"https://api.github.com/users/dfordivam/following{/other_user}","gists_url":"https://api.github.com/users/dfordivam/gists{/gist_id}","starred_url":"https://api.github.com/users/dfordivam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dfordivam/subscriptions","organizations_url":"https://api.github.com/users/dfordivam/orgs","repos_url":"https://api.github.com/users/dfordivam/repos","events_url":"https://api.github.com/users/dfordivam/events{/privacy}","received_events_url":"https://api.github.com/users/dfordivam/received_events","type":"User","site_admin":false},"html_url":"https://github.com/dfordivam/reflex-examples","description":" Reflex FRP is a composable, cross-platform functional reactive programming framework for Haskell. It allows you to build interactive components in pure functional style, working in harmony with established Haskell techniques and improving the quality and elegance of your applications.","fork":true,"url":"https://api.github.com/repos/dfordivam/reflex-examples","forks_url":"https://api.github.com/repos/dfordivam/reflex-examples/forks","keys_url":"https://api.github.com/repos/dfordivam/reflex-examples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dfordivam/reflex-examples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dfordivam/reflex-examples/teams","hooks_url":"https://api.github.com/repos/dfordivam/reflex-examples/hooks","issue_events_url":"https://api.github.com/repos/dfordivam/reflex-examples/issues/events{/number}","events_url":"https://api.github.com/repos/dfordivam/reflex-examples/events","assignees_url":"https://api.github.com/repos/dfordivam/reflex-examples/assignees{/user}","branches_url":"https://api.github.com/repos/dfordivam/reflex-examples/branches{/branch}","tags_url":"https://api.github.com/repos/dfordivam/reflex-examples/tags","blobs_url":"https://api.github.com/repos/dfordivam/reflex-examples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dfordivam/reflex-examples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dfordivam/reflex-examples/git/refs{/sha}","trees_url":"https://api.github.com/repos/dfordivam/reflex-examples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dfordivam/reflex-examples/statuses/{sha}","languages_url":"https://api.github.com/repos/dfordivam/reflex-examples/languages","stargazers_url":"https://api.github.com/repos/dfordivam/reflex-examples/stargazers","contributors_url":"https://api.github.com/repos/dfordivam/reflex-examples/contributors","subscribers_url":"https://api.github.com/repos/dfordivam/reflex-examples/subscribers","subscription_url":"https://api.github.com/repos/dfordivam/reflex-examples/subscription","commits_url":"https://api.github.com/repos/dfordivam/reflex-examples/commits{/sha}","git_commits_url":"https://api.github.com/repos/dfordivam/reflex-examples/git/commits{/sha}","comments_url":"https://api.github.com/repos/dfordivam/reflex-examples/comments{/number}","issue_comment_url":"https://api.github.com/repos/dfordivam/reflex-examples/issues/comments{/number}","contents_url":"https://api.github.com/repos/dfordivam/reflex-examples/contents/{+path}","compare_url":"https://api.github.com/repos/dfordivam/reflex-examples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dfordivam/reflex-examples/merges","archive_url":"https://api.github.com/repos/dfordivam/reflex-examples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dfordivam/reflex-examples/downloads","issues_url":"https://api.github.com/repos/dfordivam/reflex-examples/issues{/number}","pulls_url":"https://api.github.com/repos/dfordivam/reflex-examples/pulls{/number}","milestones_url":"https://api.github.com/repos/dfordivam/reflex-examples/milestones{/number}","notifications_url":"https://api.github.com/repos/dfordivam/reflex-examples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dfordivam/reflex-examples/labels{/name}","releases_url":"https://api.github.com/repos/dfordivam/reflex-examples/releases{/id}","deployments_url":"https://api.github.com/repos/dfordivam/reflex-examples/deployments","created_at":"2018-11-09T10:14:51Z","updated_at":"2018-11-27T21:21:05Z","pushed_at":"2018-11-27T21:21:03Z","git_url":"git://github.com/dfordivam/reflex-examples.git","ssh_url":"git@github.com:dfordivam/reflex-examples.git","clone_url":"https://github.com/dfordivam/reflex-examples.git","svn_url":"https://github.com/dfordivam/reflex-examples","homepage":"https://reflex-frp.org/","size":1857,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"reflex-frp:master","ref":"master","sha":"fc1318288dcd17225b3f1a840ad0bf53217304b0","user":{"login":"reflex-frp","id":11824260,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExODI0MjYw","avatar_url":"https://avatars3.githubusercontent.com/u/11824260?v=4","gravatar_id":"","url":"https://api.github.com/users/reflex-frp","html_url":"https://github.com/reflex-frp","followers_url":"https://api.github.com/users/reflex-frp/followers","following_url":"https://api.github.com/users/reflex-frp/following{/other_user}","gists_url":"https://api.github.com/users/reflex-frp/gists{/gist_id}","starred_url":"https://api.github.com/users/reflex-frp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reflex-frp/subscriptions","organizations_url":"https://api.github.com/users/reflex-frp/orgs","repos_url":"https://api.github.com/users/reflex-frp/repos","events_url":"https://api.github.com/users/reflex-frp/events{/privacy}","received_events_url":"https://api.github.com/users/reflex-frp/received_events","type":"Organization","site_admin":false},"repo":{"id":39098952,"node_id":"MDEwOlJlcG9zaXRvcnkzOTA5ODk1Mg==","name":"reflex-examples","full_name":"reflex-frp/reflex-examples","private":false,"owner":{"login":"reflex-frp","id":11824260,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExODI0MjYw","avatar_url":"https://avatars3.githubusercontent.com/u/11824260?v=4","gravatar_id":"","url":"https://api.github.com/users/reflex-frp","html_url":"https://github.com/reflex-frp","followers_url":"https://api.github.com/users/reflex-frp/followers","following_url":"https://api.github.com/users/reflex-frp/following{/other_user}","gists_url":"https://api.github.com/users/reflex-frp/gists{/gist_id}","starred_url":"https://api.github.com/users/reflex-frp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reflex-frp/subscriptions","organizations_url":"https://api.github.com/users/reflex-frp/orgs","repos_url":"https://api.github.com/users/reflex-frp/repos","events_url":"https://api.github.com/users/reflex-frp/events{/privacy}","received_events_url":"https://api.github.com/users/reflex-frp/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/reflex-frp/reflex-examples","description":" Reflex FRP is a composable, cross-platform functional reactive programming framework for Haskell. It allows you to build interactive components in pure functional style, working in harmony with established Haskell techniques and improving the quality and elegance of your applications.","fork":false,"url":"https://api.github.com/repos/reflex-frp/reflex-examples","forks_url":"https://api.github.com/repos/reflex-frp/reflex-examples/forks","keys_url":"https://api.github.com/repos/reflex-frp/reflex-examples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reflex-frp/reflex-examples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reflex-frp/reflex-examples/teams","hooks_url":"https://api.github.com/repos/reflex-frp/reflex-examples/hooks","issue_events_url":"https://api.github.com/repos/reflex-frp/reflex-examples/issues/events{/number}","events_url":"https://api.github.com/repos/reflex-frp/reflex-examples/events","assignees_url":"https://api.github.com/repos/reflex-frp/reflex-examples/assignees{/user}","branches_url":"https://api.github.com/repos/reflex-frp/reflex-examples/branches{/branch}","tags_url":"https://api.github.com/repos/reflex-frp/reflex-examples/tags","blobs_url":"https://api.github.com/repos/reflex-frp/reflex-examples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reflex-frp/reflex-examples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reflex-frp/reflex-examples/git/refs{/sha}","trees_url":"https://api.github.com/repos/reflex-frp/reflex-examples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reflex-frp/reflex-examples/statuses/{sha}","languages_url":"https://api.github.com/repos/reflex-frp/reflex-examples/languages","stargazers_url":"https://api.github.com/repos/reflex-frp/reflex-examples/stargazers","contributors_url":"https://api.github.com/repos/reflex-frp/reflex-examples/contributors","subscribers_url":"https://api.github.com/repos/reflex-frp/reflex-examples/subscribers","subscription_url":"https://api.github.com/repos/reflex-frp/reflex-examples/subscription","commits_url":"https://api.github.com/repos/reflex-frp/reflex-examples/commits{/sha}","git_commits_url":"https://api.github.com/repos/reflex-frp/reflex-examples/git/commits{/sha}","comments_url":"https://api.github.com/repos/reflex-frp/reflex-examples/comments{/number}","issue_comment_url":"https://api.github.com/repos/reflex-frp/reflex-examples/issues/comments{/number}","contents_url":"https://api.github.com/repos/reflex-frp/reflex-examples/contents/{+path}","compare_url":"https://api.github.com/repos/reflex-frp/reflex-examples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reflex-frp/reflex-examples/merges","archive_url":"https://api.github.com/repos/reflex-frp/reflex-examples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reflex-frp/reflex-examples/downloads","issues_url":"https://api.github.com/repos/reflex-frp/reflex-examples/issues{/number}","pulls_url":"https://api.github.com/repos/reflex-frp/reflex-examples/pulls{/number}","milestones_url":"https://api.github.com/repos/reflex-frp/reflex-examples/milestones{/number}","notifications_url":"https://api.github.com/repos/reflex-frp/reflex-examples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reflex-frp/reflex-examples/labels{/name}","releases_url":"https://api.github.com/repos/reflex-frp/reflex-examples/releases{/id}","deployments_url":"https://api.github.com/repos/reflex-frp/reflex-examples/deployments","created_at":"2015-07-14T20:33:40Z","updated_at":"2018-11-14T21:14:23Z","pushed_at":"2018-11-27T21:21:04Z","git_url":"git://github.com/reflex-frp/reflex-examples.git","ssh_url":"git@github.com:reflex-frp/reflex-examples.git","clone_url":"https://github.com/reflex-frp/reflex-examples.git","svn_url":"https://github.com/reflex-frp/reflex-examples","homepage":"https://reflex-frp.org/","size":459,"stargazers_count":40,"watchers_count":40,"language":"Haskell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"archived":false,"open_issues_count":6,"license":null,"forks":15,"open_issues":6,"watchers":40,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/reflex-frp/reflex-examples/pulls/17"},"html":{"href":"https://github.com/reflex-frp/reflex-examples/pull/17"},"issue":{"href":"https://api.github.com/repos/reflex-frp/reflex-examples/issues/17"},"comments":{"href":"https://api.github.com/repos/reflex-frp/reflex-examples/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/reflex-frp/reflex-examples/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/reflex-frp/reflex-examples/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reflex-frp/reflex-examples/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/reflex-frp/reflex-examples/statuses/bf5a55ac0e95ad4b7a95ee9c0343c667427ad6f7"}},"author_association":"NONE"}}
{"actor":{"display_login":"dfordivam"}}