# Real-time & WebSockets (Symfony) > Mercure, WebSockets, Server-Sent Events, การแจ้งเตือนแบบ push, การอัปเดตแบบเรียลไทม์ - 18 คำถามสัมภาษณ์ - Senior - [คำถามสัมภาษณ์: Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions.md) ## 1. โปรโตคอลใดที่ Symfony แนะนำสำหรับการนำฟีเจอร์แบบเรียลไทม์ไปใช้งาน? **คำตอบ** Mercure คือโปรโตคอลที่ Symfony แนะนำอย่างเป็นทางการสำหรับฟีเจอร์แบบเรียลไทม์ พัฒนาโดย Kévin Dunglas (ผู้สร้าง API Platform) Mercure อิงตาม Server-Sent Events (SSE) และให้การผสานรวมแบบ native กับ Symfony ผ่านบันเดิล symfony/mercure ช่วยให้การสื่อสารทางเดียวจากเซิร์ฟเวอร์ไปยังไคลเอนต์มีประสิทธิภาพพร้อมการเชื่อมต่อใหม่อัตโนมัติ ## 2. ความแตกต่างหลักระหว่าง WebSockets และ Server-Sent Events (SSE) คืออะไร? **คำตอบ** WebSockets สร้างการเชื่อมต่อแบบสองทาง full-duplex ที่ให้ทั้งไคลเอนต์และเซิร์ฟเวอร์ส่งข้อความได้ทุกเมื่อ ส่วน SSE เป็นแบบทางเดียว มีเพียงเซิร์ฟเวอร์เท่านั้นที่สามารถส่งข้อมูลไปยังไคลเอนต์ได้ SSE ใช้ HTTP มาตรฐาน (ติดตั้งหลังพร็อกซีได้ง่ายกว่า) ขณะที่ WebSockets ใช้โปรโตคอลแยกต่างหากหลังจากการ handshake เริ่มต้น ## 3. บันเดิล Symfony ใดที่ช่วยให้สามารถผสานรวม Mercure เข้ากับแอปพลิเคชันได้? **คำตอบ** บันเดิล symfony/mercure-bundle ให้การผสานรวม Mercure กับ Symfony อย่างเป็นทางการ โดยจะกำหนดค่า service HubInterface สำหรับการเผยแพร่ update โดยอัตโนมัติ และสร้าง URL สำหรับการสมัครรับข้อมูล บันเดิลติดตั้งผ่าน Composer และต้องใช้ Mercure hub ภายนอก (Caddy พร้อมโมดูล Mercure หรือไบนารี Mercure แบบ standalone) ## มีอีก 15 คำถาม - จะเผยแพร่ข้อความไปยัง topic ของ Mercure จาก controller ของ Symfony ได้อย่างไร? - JWT มีหน้าที่อะไรในการยืนยันตัวตนของ Mercure สำหรับ topic แบบส่วนตัว? สมัครฟรี: https://sharpskill.dev/th/login ## หัวข้อสัมภาษณ์ Symfony อื่นๆ - [PHP สมัยใหม่ (8.1+)](https://sharpskill.dev/th/technologies/symfony/interview-questions/php-modern-features.md): 20 คำถาม, Junior - [พื้นฐาน Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions/symfony-basics.md): 25 คำถาม, Junior - [Routing & Controllers](https://sharpskill.dev/th/technologies/symfony/interview-questions/routing-controllers.md): 20 คำถาม, Junior - [Twig & Templates](https://sharpskill.dev/th/technologies/symfony/interview-questions/twig-templates.md): 20 คำถาม, Junior - [พื้นฐาน Doctrine ORM](https://sharpskill.dev/th/technologies/symfony/interview-questions/doctrine-orm-basics.md): 25 คำถาม, Junior - [ฟอร์ม Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions/forms.md): 22 คำถาม, Junior - [การตรวจสอบความถูกต้องของข้อมูล](https://sharpskill.dev/th/technologies/symfony/interview-questions/validation.md): 18 คำถาม, Junior - [Dependency Injection & Services](https://sharpskill.dev/th/technologies/symfony/interview-questions/dependency-injection.md): 24 คำถาม, Mid-Level - [Security & Authentication](https://sharpskill.dev/th/technologies/symfony/interview-questions/security-authentication.md): 26 คำถาม, Mid-Level - [Doctrine ขั้นสูง](https://sharpskill.dev/th/technologies/symfony/interview-questions/doctrine-advanced.md): 24 คำถาม, Mid-Level - [API Platform](https://sharpskill.dev/th/technologies/symfony/interview-questions/api-platform.md): 22 คำถาม, Mid-Level - [Serializer Component](https://sharpskill.dev/th/technologies/symfony/interview-questions/serializer.md): 20 คำถาม, Mid-Level - [Events & Event Subscribers](https://sharpskill.dev/th/technologies/symfony/interview-questions/events-subscribers.md): 20 คำถาม, Mid-Level - [Console & Commands](https://sharpskill.dev/th/technologies/symfony/interview-questions/console-commands.md): 18 คำถาม, Mid-Level - [Messenger Component](https://sharpskill.dev/th/technologies/symfony/interview-questions/messenger.md): 22 คำถาม, Mid-Level - [HTTP Client](https://sharpskill.dev/th/technologies/symfony/interview-questions/http-client.md): 18 คำถาม, Mid-Level - [Cache & ประสิทธิภาพ](https://sharpskill.dev/th/technologies/symfony/interview-questions/cache.md): 20 คำถาม, Mid-Level - [Workflow Component](https://sharpskill.dev/th/technologies/symfony/interview-questions/workflow.md): 18 คำถาม, Mid-Level - [Testing Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions/testing.md): 22 คำถาม, Mid-Level - [Mailer Component](https://sharpskill.dev/th/technologies/symfony/interview-questions/mailer.md): 16 คำถาม, Mid-Level - [การแปลและ i18n](https://sharpskill.dev/th/technologies/symfony/interview-questions/translations.md): 16 คำถาม, Mid-Level - [EasyAdmin Bundle](https://sharpskill.dev/th/technologies/symfony/interview-questions/easyadmin.md): 18 คำถาม, Mid-Level - [สถาปัตยกรรม Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions/architecture-patterns.md): 24 คำถาม, Senior - [ประสิทธิภาพและการเพิ่มประสิทธิภาพ](https://sharpskill.dev/th/technologies/symfony/interview-questions/performance-optimization.md): 22 คำถาม, Senior - [ความปลอดภัยขั้นสูง](https://sharpskill.dev/th/technologies/symfony/interview-questions/security-advanced.md): 22 คำถาม, Senior - [Custom Bundles](https://sharpskill.dev/th/technologies/symfony/interview-questions/custom-bundles.md): 20 คำถาม, Senior - [Microservices ด้วย Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions/microservices.md): 22 คำถาม, Senior - [Deployment & DevOps](https://sharpskill.dev/th/technologies/symfony/interview-questions/deployment-devops.md): 20 คำถาม, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/th/technologies/symfony/interview-questions/real-time