[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"academy-blogs-th-1-1-all-graphql-websocket-go-chat-system-all--*":3,"academy-blog-translations-nk24bp8xvrc361u":109},{"data":4,"page":97,"perPage":97,"totalItems":97,"totalPages":97},[5],{"alt":6,"collectionId":7,"collectionName":8,"content":9,"cover_image":10,"cover_image_path":11,"created":12,"created_by":13,"expand":14,"id":103,"keywords":104,"locale":79,"published_at":105,"scheduled_at":13,"school_blog":101,"short_description":106,"slug":107,"status":99,"title":6,"updated":108,"updated_by":13,"views":102},"EP.34 การสร้างระบบแชทแบบเรียลไทม์ด้วย GraphQL และ WebSocket ใน Go","sclblg987654321","school_blog_translations","\u003Ch2>การสร้างระบบแชทแบบเรียลไทม์ – ทำไมต้องใช้ GraphQL และ WebSocket?\u003C\u002Fh2>\u003Cp>ใในยุคของแอปพลิเคชันแบบเรียลไทม์ ระบบแชท เป็นหนึ่งในฟีเจอร์สำคัญที่ต้องรองรับการส่งข้อความทันที GraphQL Subscriptions และ WebSocket ช่วยให้ไคลเอนต์สามารถติดตามการเปลี่ยนแปลงของข้อมูล และรับข้อความใหม่ได้ทันทีโดยไม่ต้องเรียก API ซ้ำๆ\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch3>โครงสร้างของระบบแชท\u003C\u002Fh3>\u003Col>\u003Cli>GraphQL Server - ทำหน้าที่เป็น API ที่รองรับ Query, Mutation และ Subscription\u003C\u002Fli>\u003Cli>WebSocket Gateway - จัดการการเชื่อมต่อและส่งข้อความแบบเรียลไทม์\u003C\u002Fli>\u003Cli>Database (PostgreSQL\u002FRedis) - เก็บประวัติการสนทนาและสถานะของผู้ใช้\u003C\u002Fli>\u003C\u002Fol>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch3>การสร้าง GraphQL Schema สำหรับระบบแชท\u003C\u002Fh3>\u003Cp>ไฟล์ schema.graphql\u003C\u002Fp>\u003Cpre>\u003Ccode class=\"language-plaintext\">type Query {\n  messages: [Message!]!\n}\n\ntype Mutation {\n  sendMessage(content: String!, sender: String!): Message!\n}\n\ntype Subscription {\n  messageReceived: Message!\n}\n\ntype Message {\n  id: ID!\n  content: String!\n  sender: String!\n  timestamp: String!\n}\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch4>ท้าให้ลอง!\u003C\u002Fh4>\u003Cp>ลองขยายระบบแชทให้รองรับ ห้องแชท (Chat Rooms) และ การแจ้งเตือนผู้ใช้ โดยใช้ WebSocket และ Redis Pub\u002FSub เพื่อให้สามารถกระจายข้อความไปยังเซิร์ฟเวอร์หลายเครื่องได้\u003C\u002Fp>\u003Chr>\u003Ch4>EP ถัดไป\u003C\u002Fh4>\u003Cp>ใน EP.35 เราจะมาพูดถึง การปรับปรุงประสิทธิภาพของระบบแชท ด้วยการใช้ Redis และ Load Balancing เพื่อรองรับปริมาณผู้ใช้งานจำนวนมาก! เตรียมพบกันเร็วๆ นี้ 🚀\u003C\u002Fp>","39_11zon_4799hcze22.webp","https:\u002F\u002Ftwsme-r2.tumwebsme.com\u002Fsclblg987654321\u002Fh4wo4wjrss229ds\u002F39_11zon_4799hcze22.webp","2026-03-04 08:51:20.301Z","",{"keywords":15,"locale":73,"school_blog":83},[16,23,28,33,38,43,48,53,58,63,68],{"collectionId":17,"collectionName":18,"created":19,"created_by":13,"id":20,"name":21,"updated":22,"updated_by":13},"sclkey987654321","school_keywords","2026-03-04 08:51:14.205Z","laiwsvubam25wcf","GraphQL","2026-04-10 16:14:34.380Z",{"collectionId":17,"collectionName":18,"created":24,"created_by":13,"id":25,"name":26,"updated":27,"updated_by":13},"2026-03-04 08:34:00.920Z","ecac9y661or1xka","WebSocket","2026-04-10 16:08:05.227Z",{"collectionId":17,"collectionName":18,"created":29,"created_by":13,"id":30,"name":31,"updated":32,"updated_by":13},"2026-03-04 08:20:11.547Z","ey3puyme01a9bsw","Go","2026-04-10 16:07:25.893Z",{"collectionId":17,"collectionName":18,"created":34,"created_by":13,"id":35,"name":36,"updated":37,"updated_by":13},"2026-03-04 08:20:14.253Z","ah6lvy4x8qe08l5","Golang","2026-04-10 16:07:26.172Z",{"collectionId":17,"collectionName":18,"created":39,"created_by":13,"id":40,"name":41,"updated":42,"updated_by":13},"2026-03-04 08:46:53.342Z","5ac1xgod1ehyqva","GraphQL Subscriptions","2026-04-10 16:13:20.256Z",{"collectionId":17,"collectionName":18,"created":44,"created_by":13,"id":45,"name":46,"updated":47,"updated_by":13},"2026-03-04 08:47:05.949Z","caufix9o52uw4bh","Real-Time Chat","2026-04-10 16:13:23.517Z",{"collectionId":17,"collectionName":18,"created":49,"created_by":13,"id":50,"name":51,"updated":52,"updated_by":13},"2026-03-04 08:46:14.782Z","v0mhensk18fofru","WebSocket Chat","2026-04-10 16:13:10.563Z",{"collectionId":17,"collectionName":18,"created":54,"created_by":13,"id":55,"name":56,"updated":57,"updated_by":13},"2026-03-04 08:51:19.718Z","jqvc882wc9kcby8","Chat Application","2026-04-10 16:14:35.447Z",{"collectionId":17,"collectionName":18,"created":59,"created_by":13,"id":60,"name":61,"updated":62,"updated_by":13},"2026-03-04 08:51:19.902Z","ybwrb9ksy12o89r","API Development","2026-04-10 16:14:35.541Z",{"collectionId":17,"collectionName":18,"created":64,"created_by":13,"id":65,"name":66,"updated":67,"updated_by":13},"2026-03-04 08:44:29.876Z","ozn15duk6wovj6g","Microservices","2026-04-10 16:12:46.024Z",{"collectionId":17,"collectionName":18,"created":69,"created_by":13,"id":70,"name":71,"updated":72,"updated_by":13},"2026-03-04 08:51:19.396Z","u64yt1w9x0lqknb","System Scalability","2026-04-10 16:14:35.375Z",{"code":74,"collectionId":75,"collectionName":76,"created":77,"flag":78,"id":79,"is_default":80,"label":81,"updated":82},"th","pbc_1989393366","locales","2026-01-22 10:59:55.832Z","twemoji:flag-thailand","s8wri3bt4vgg2ji",true,"Thai","2026-04-10 15:42:46.614Z",{"category":84,"collectionId":85,"collectionName":86,"expand":87,"id":101,"views":102},"wqxt7ag2gn7xcmk","pbc_2105096300","school_blogs",{"category":88},{"blogIds":89,"collectionId":90,"collectionName":91,"created":92,"created_by":13,"id":84,"image":93,"image_alt":13,"image_path":94,"label":95,"name":96,"priority":97,"publish_at":98,"scheduled_at":13,"status":99,"updated":100,"updated_by":13},[],"sclcatblg987654321","school_category_blogs","2026-03-04 08:33:53.210Z","59ty92ns80w_15oc1implw.png","https:\u002F\u002Ftwsme-r2.tumwebsme.com\u002Fsclcatblg987654321\u002Fwqxt7ag2gn7xcmk\u002F59ty92ns80w_15oc1implw.png",{"en":96,"th":96},"Golang The Series",1,"2026-03-16 04:39:38.440Z","published","2026-04-25 02:32:15.470Z","nk24bp8xvrc361u",265,"h4wo4wjrss229ds",[20,25,30,35,40,45,50,55,60,65,70],"2025-03-13 02:23:41.152Z","เรียนรู้วิธีใช้ GraphQL Subscriptions และ WebSocket เพื่อสร้างระบบแชทแบบเรียลไทม์ใน Go รองรับการส่งข้อความแบบทันที และออกแบบให้สามารถปรับขนาดได้อย่างมีประสิทธิภาพ","graphql-websocket-go-chat-system","2026-04-22 07:11:46.180Z",{"th":107}]