{"id":21051033,"url":"https://github.com/gizipp/chat-demo","last_synced_at":"2025-03-13T23:20:58.522Z","repository":{"id":85357374,"uuid":"130286919","full_name":"gizipp/chat-demo","owner":"gizipp","description":"A kind of basic chat API backend using Faye-websocket","archived":false,"fork":false,"pushed_at":"2018-04-23T01:51:20.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-20T18:36:21.402Z","etag":null,"topics":["chat-application","faye","faye-client","faye-websocket","heroku","puma","ruby","sinatra","websocket"],"latest_commit_sha":null,"homepage":"https://chat-backend-demo.herokuapp.com/v1/chat","language":"Ruby","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/gizipp.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-20T00:26:06.000Z","updated_at":"2020-03-31T06:55:33.000Z","dependencies_parsed_at":"2023-03-13T04:58:24.667Z","dependency_job_id":null,"html_url":"https://github.com/gizipp/chat-demo","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/gizipp%2Fchat-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gizipp%2Fchat-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gizipp%2Fchat-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gizipp%2Fchat-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gizipp","download_url":"https://codeload.github.com/gizipp/chat-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243495377,"owners_count":20299924,"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":["chat-application","faye","faye-client","faye-websocket","heroku","puma","ruby","sinatra","websocket"],"created_at":"2024-11-19T15:49:25.873Z","updated_at":"2025-03-13T23:20:58.492Z","avatar_url":"https://github.com/gizipp.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chat Backend Demo\n\nA kind of basic chat API backend.\n\n# Features\n  1. API to send message\n  2. API to retrieve message\n  3. API to retrieve message at realtime\n\n# REST API\n\n  - POST `/v1/chat`\n  - GET `/v1/chat`\n\n#### POST `/v1/chat` sending message\n\nIt send message.\n\n##### Parameters:\n\nIts accepts via form-data, x-www-form-urlencoded or json body data. Required parameters are :\n  - text: The message text maximum 500 chars. (Required)\n\n#### Example Usage:\n\n`curl -X POST https://chat-backend-demo.herokuapp.com/v1/chat -d '{\"text\": \"How are you?\"}'`\n\n#### GET `/v1/chat` retrieving message\n\nIt returns messages.\n\n##### Parameters:\n\nOptional query parameters are :\n\n - before: The start point of the created_at in result messages. It must be RFC3339 form. (Optional)\n - limit: The number of result messages. Default : 10 (Optional)\n\n  Request JSON:\n\n  ```\n    {\n      \"before\": \"time with ISO8601 format\",\n      \"limit\": limit_number,\n  }\n  ```\n\n  response JSON:\n\n  ```\n  [\n    {\n        \"_id\": message_object_id,\n        \"text\":  \"\u003cmessage content\u003e\",\n        \"created_at\": created_at,\n    },\n    ...\n  ]   \n```\n\n#### Example Usage:\n\n`curl -X GET 'https://chat-backend-demo.herokuapp.com/v1/chat?before=2018-04-23T04:14:12+07:00\u0026limit=5'`\n\nwill returns queried result which contains 10 messages and all of these are created before 2018/04/23 04:14:12\n\n# Stream API\n  -  `/v1/chat/stream`\n\n  The server can accepts the Websocket connetion at `/v1/chat/stream`\n\n#### Example Usage :\n\n  via Curl\n\n  `curl -i -N -H \"Connection: Upgrade\" -H \"Upgrade: websocket\" -H \"Host: chat-backend-demo.herokuapp.com\" -H \"Origin: https://chat-backend-demo.herokuapp.com\" chat-backend-demo.herokuapp.com/v1/chat/stream`\n\n   Result :\n\n   ```\n   HTTP/1.1 101 Switching Protocols\nConnection: Upgrade\nUpgrade: WebSocket\nWebsocket-Origin: https://chat-backend-demo.herokuapp.com\nWebsocket-Location: wss://chat-backend-demo.herokuapp.com/v1/chat/stream\nVia: 1.1 vegur\n\n\n{\"_id\":{\"$oid\":\"5add2c701ab7ad0004e7939b\"},\"created_at\":\"2018-04-23T00:44:32.322+00:00\",\"text\":\"How are you?\"}\n{\"_id\":{\"$oid\":\"5add2c711ab7ad0004e7939c\"},\"created_at\":\"2018-04-23T00:44:33.578+00:00\",\"text\":\"Fine?\"}\n{\"_id\":{\"$oid\":\"5add2c721ab7ad0004e7939d\"},\"created_at\":\"2018-04-23T00:44:34.886+00:00\",\"text\":\"Okay?\"}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgizipp%2Fchat-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgizipp%2Fchat-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgizipp%2Fchat-demo/lists"}