{"id":23276248,"url":"https://github.com/dinoscapeprogramming/chat-package","last_synced_at":"2025-04-06T11:45:04.436Z","repository":{"id":58468868,"uuid":"531579720","full_name":"DinoscapeProgramming/Chat-Package","owner":"DinoscapeProgramming","description":"A package you can use to create a Chat with express and socket.io","archived":false,"fork":false,"pushed_at":"2022-09-05T11:30:58.000Z","size":86,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-15T12:46:34.701Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/DinoscapeProgramming.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":"2022-09-01T15:32:02.000Z","updated_at":"2022-09-01T15:32:40.000Z","dependencies_parsed_at":"2023-01-17T20:15:45.130Z","dependency_job_id":null,"html_url":"https://github.com/DinoscapeProgramming/Chat-Package","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/DinoscapeProgramming%2FChat-Package","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DinoscapeProgramming%2FChat-Package/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DinoscapeProgramming%2FChat-Package/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DinoscapeProgramming%2FChat-Package/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DinoscapeProgramming","download_url":"https://codeload.github.com/DinoscapeProgramming/Chat-Package/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478252,"owners_count":20945262,"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":[],"created_at":"2024-12-19T21:30:07.659Z","updated_at":"2025-04-06T11:45:04.420Z","avatar_url":"https://github.com/DinoscapeProgramming.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chat Package\nA package you can use to create a Chat with express and socket.io\n\n## Create a database\nCreate a file with this json content in it\n```json\n{\n  \"users\": {},\n  \"rooms\": {}\n}\n```\n\n## Class Documentation\n### Setup\n```js\nconst express = require('express');\nconst app = express();\nconst http = require('http').Server(app);\nconst io = require('socket.io')(http);\nconst socketChat = require('socket.io-chat');\nconst Chat = new socketChat.Chat(app, {\n  file: \"./chat.json\"\n} // options that always will be the same, {\n  messageCharacterLimit: 200, // Limit of characters of a message\n  roomNameCharacterLimit: 30, // Limit of characters of a room name\n  usernameCharacterLimit: 20, // Limit of characters of a username\n} // options that can be defined and overwrited for each single request);\n\nio.on('connection', (socket, name) =\u003e {});\n```\n\n### Default options\n#### Message Limit\nUnlimited\n\n#### Room Name Character Limit\nUnlimited\n\n#### Username Character Limit\nUnlimited\n\n### Create Room\n```js\nsocket.on(\"createRoom\", (options) =\u003e {\n  const result = Chat.rooms({\n    roomNameCharacterLimit: 50 // other options you can use to overwrite the options of the class\n  }).create(socket.id, options, { roomNameCharacterLimit: 40 } /* this options can overwrite the other options*/);\n  socket.emit(result.action, result);\n});\n```\n\n### Edit Room\n```js\nsocket.on(\"editRoom\", (options) =\u003e {\n  const result = Chat.rooms({\n    roomNameCharacterLimit: 50 // other options you can use to overwrite the options of the class\n  }).edit(socket.id, options, { roomNameCharacterLimit: 40 } /* this options can overwrite the other options */);\n  socket.emit(result.action, result);\n});\n```\n\n### Delete Room\n```js\nsocket.on(\"deleteRoom\", (options) =\u003e {\n  const result = Chat.rooms({\n    // other options you can use to overwrite the options of the class, but there are currently no \n  }).delete(socket.id, options, {} /* this options can overwrite the other options, but there are currently no */);\n  socket.emit(result.action, result);\n});\n```\n\n### Get Room\n```js\nsocket.on(\"getRoom\", (options) =\u003e {\n  const result = Chat.rooms({\n    // other options you can use to overwrite the options of the class, but there are currently no\n  }).get(socket.id, options, {} /* this options can overwrite the other options, but there are currently no */);\n  socket.emit(socket.id, result);\n});\n```\n\n### All Rooms\n```js\nsocket.on(\"allRooms\", (options) =\u003e {\n  const result = Chat.rooms({\n    // other options you can use to overwrite the options of the class, but there are currently no\n  }).all(socket.id, options, {} /* this options can overwrite the other options, but there are currently no */);\n  socket.emit(socket.id, result);\n});\n```\n\n### Send Message\n```js\nsocket.on(\"sendMessage\", (options) =\u003e {\n  const result = Chat.messages({\n    messageCharacterLimit: 20 // other options you can use to overwrite the options of the class\n  }).send(socket.id, options, { messageCharacterLimit: 15 } /* this options can overwrite the other options */);\n  socket.emit(socket.id, result);\n});\n```\n\n### Edit Message\n```js\nsocket.on(\"editMessage\", (options) =\u003e {\n  const result = Chat.messages({\n    messageCharacterLimit: 20 // other options you can use to overwrite the options of the class\n  }).edit(socket.id, options, { messageCharacterLimit: 15 } /* this options can overwrite the other options */);\n  socket.emit(socket.id, result);\n});\n```\n\n### Delete Message\n```js\nsocket.on(\"deleteMessage\", (options) =\u003e {\n  const result = Chat.messages({\n    // other options you can use to overwrite the options of the class, but there are currently no\n  }).delete(socket.id, options, {} /* this options can overwrite the other options, but there are currently no */);\n  socket.emit(socket.id, result);\n});\n```\n\n### Get Message\n```js\nsocket.on(\"getMessage\", (options) =\u003e {\n  const result = Chat.messages({\n    // other options you can use to overwrite the options of the class, but there are currently no\n  }).get(socket.id, options, {} /* this options can overwrite the other options, but there are currently no */);\n  socket.emit(socket.id, result);\n});\n```\n\n### Create User\n```js\nsocket.on(\"createUser\", (options) =\u003e {\n  const result = Chat.users({\n    usernameCharacterLimit: 15 // other options you can use to overwrite the options of the class\n  }).create(socket.id, options, { usernameCharacterLimit: 25 } /* this options can overwrite the other options */);\n  socket.emit(socket.id, result);\n});\n```\n\n### Edit User\n```js\nsocket.on(\"editUser\", (options) =\u003e {\n  const result = Chat.users({\n    usernameCharacterLimit: 15 // other options you can use to overwrite the options of the class\n  }).edit(socket.id, options, { usernameCharacterLimit: 25 } /* this options can overwrite the other options */);\n  socket.emit(socket.id, result);\n});\n```\n\n### Delete User\n```js\nsocket.on(\"deleteUser\", (options) =\u003e {\n  const result = Chat.users({\n    // other options you can use to overwrite the options of the class, but there are currently no \n  }).delete(socket.id, options, {} /* this options can overwrite the other options, but there are currently no */);\n  socket.emit(socket.id, result);\n});\n```\n\n### Get User\n```js\nsocket.on(\"getUser\", (options) =\u003e {\n  const result = Chat.users({\n    // other options you can use to overwrite the options of the class, but there are currently no\n  }).get(socket.id, options, {} /* this options can overwrite the other options, but there are currently no */);\n  socket.emit(socket.id, result);\n});\n```\n\n## HTML Client Side Documentation\n### Setup\n```html\n\u003cscript src=\"/socket.io-chat/socket.io-chat.js\"\u003e\n```\n\n### Configuration\n```js\nconst socket = io();\nconst chat = new Chat(socket);\n```\n\n### Create Room\n```js\nChat.rooms().create(options);\n```\n\n### Edit Room\n```js\nChat.rooms().edit(options);\n```\n\n### Delete Room\n```js\nChat.rooms().delete(options);\n```\n\n### Get Room\n```js\nChat.rooms().get(options);\n```\n\n### All Rooms\n```js\nChat.rooms().all();\n```\n\n### Send Message\n```js\nChat.messages().send(options);\n```\n\n### Edit Message\n```js\nChat.messages().edit(options);\n```\n\n### Delete Message\n```js\nChat.messages().delete(options);\n```\n\n### Get Message\n```js\nChat.messages().get(options);\n```\n\n### Create User\n```js\nChat.users().create(options);\n```\n\n### Edit User\n```js\nChat.users().edit(options);\n```\n\n### Delete User\n```js\nChat.users().delete(options);\n```\n\n### Get User\n```js\nChat.users().get(options);\n```\n\n## Functions\n```js\n[\n  isURL,\n  configRooms,\n  createRoom,\n  editRoom,\n  deleteRoom,\n  getRoom,\n  allRooms,\n  joinRoom,\n  leaveRoom,\n  sendMessage,\n  editMessage,\n  deleteMessage,\n  getMessage,\n  createUser,\n  editUser,\n  deleteUser,\n  getUser,\n  isURLSync,\n  configRoomsSync,\n  createRoomSync,\n  editRoomSync,\n  deleteRoomSync,\n  getRoomSync,\n  allRoomsSync,\n  joinRoomSync,\n  leaveRoomSync,\n  sendMessageSync,\n  editMessageSync,\n  deleteMessageSync,\n  getMessageSync,\n  createUserSync,\n  editUserSync,\n  deleteUserSync,\n  getUserSync\n]\n```\n\n## Classes\n```js\n[\n  Chat,\n  RoomManager,\n  MessageManager,\n  UserManager,\n  UtilManager,\n  FunctionManager\n]\n```\n\n## Types\n```json\n{\n  \"Types\": {\n    \"Managers\": {\n      \"Rooms\": \"rooms\",\n      \"Messages\": \"messages\",\n      \"Users\": \"users\",\n      \"Util\": \"util\",\n      \"Functions\": \"functions\"\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdinoscapeprogramming%2Fchat-package","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdinoscapeprogramming%2Fchat-package","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdinoscapeprogramming%2Fchat-package/lists"}