SlideShare a Scribd company logo
1 of 20
Socket.IO
on
SmartFX
Takeshi Morita @takeshy
Minkabu Inc.
CONTENTS
 What is SmartFX?
 Coding Hints for the usage of Socket.IO
 Considerations on using Socket.IO
 The Middleware, Socket.IO-ReqEv
 Operation of Socket.IO server
 Redundancy and load balancing
 Shutdown in case of deploy
What is SmartFX?
What is SmartFX?
 A free site for smartphone developed by Minkabu to
provide FX information including news, charts and
predictions
 A real-time Single Page Application based on
Socket.IO and Backbone.js
Go to -
http://smartfx.jp
or real URL http://smartfx.minkabu.jp
Coding Hints
for the usage of Socket.IO
Considerations
on using Sockeet.IO
 Socket.IO has powerful Socket managing tools of
“NameSpace”, “Rooms” and “Events”
 Their interchangeable feature, there's more than one
way to manage a broadcast client.
 We, therefore, introduced our own coding rules in
SmartFX
Coding Rules in SmartFX
 One Object for One NameSpace
 One Event for One Room with One EventName
 Each event shall be emitted using Room feature
 Define 3 Types of Event of “message”, ”reply”
and ”error”
 “message” shall be used for the data transfer from a client to
the server
 “reply” and ”error” shall be used for from the server to a client
The Middleware, Stock.IO-ReqEv
 With coding rules, succeeded to create a Middleware
with specialized feature of Stock.IO procedures
 We named the Middleware “Socket.IO-ReqEv”
 You can install below
npm install socket.io-reqev
How to use Socket.IO-ReqEv
-the server side-
Only 2 steps
1. Create a IOReqEv object with an initial value of a
Socket.IO object.
2. Call “register” method giving NameSpace & object met
with the rule of IO-ReqEv
*Example above shows the simplest case of one set of registration. This
“register” method can be called repeatedly.
Rules to pass objects to Socke.IO-
ReqEv
1. Set event name to the property of
array “events”
2. Emit event with data, inheriting
EventEmitter
3. Implement a method “request”,
which Socket.IO-ReqEv calls when a
message from client includes a
parameter of “requests” . This works
similar to HTTP GET
*Codes on the left runs to broadcast events
every second/minute and emit the current time
How to use Socket.IO-ReqEv
-the client side-
Only 2 steps on browser
1. Create IOReqEvClient, giving the url which includes the
address of Socket.IO and namespace, and callback
2. Call a method “watch” to subscribe an event and to get a
request
*unsubscribe automatically unnecessary events previously called, once the method
“watch” is called again with another events
Implementation of Socket.IO-ReqEv
 The library of Socket.IO-ReqEv is written with just less
than 60 coding lines
 Moreover, the library is written with public properties
only on Socket.IO 1.0, while there were some non-
public properties on 0.9.x
 The source code of Socket.IO-ReqEv is available at url
below
https://github.com/takeshy/socket.io-reqev
Operation of Socket.IO server
System Configulation
Redundancy and Load Balancing
 Redundancy and load balancing are accomplished-
 Socket.IO server updates its record on the DB periodically
 WebServer gets a list of address of Socket.IO server recently
updated from the DB
 WebServer Returns one of them randomly to a client
Redundancy and Load Balancing
Sequences
Shutdown in case of Deploy
 Delete command in demon management tool of pm2
does not work under the situation of Socket.IO being
always connected to client
 To solve this problem, developed a self-shutdown
mechanism of Socket.IO server
The Workflow of Deploy
 Update app source code in the Socket.IO server, and run the script
which executes pm2 command of “delete” and “start”. (by capistrano)
 Set “inactive” to the status field of the Socket.IO record on the DB
 Once the Socket.IO detects its own record set as “inactive”, the server
broadcasts inactive event to clients and set timer to kill itself a minute
later
 A client which received inactive event displays a popup message saying
“disconnected the server” in case the user stays more than 1 minute.
(in case a user goes to different page, the client gets another server
address, then network connection stays)
 Set “activate” to the status field of the Socket.IO record on the DB
Socket.IO Shutdown
Sequences
Thank you!

More Related Content

Similar to socket.io on SmartFx

Going real time with Socket.io
Going real time with Socket.ioGoing real time with Socket.io
Going real time with Socket.ioArnout Kazemier
 
Vert.x for Microservices Architecture
Vert.x for Microservices ArchitectureVert.x for Microservices Architecture
Vert.x for Microservices ArchitectureIdan Fridman
 
Rapid Network Application Development with Apache MINA
Rapid Network Application Development with Apache MINARapid Network Application Development with Apache MINA
Rapid Network Application Development with Apache MINAtrustinlee
 
Behind the scenes of Scaleway Functions : when Kubernetes meets our products
Behind the scenes of Scaleway Functions : when Kubernetes meets our productsBehind the scenes of Scaleway Functions : when Kubernetes meets our products
Behind the scenes of Scaleway Functions : when Kubernetes meets our productsScaleway
 
Reactotron - A Debugging Agent
Reactotron -  A Debugging AgentReactotron -  A Debugging Agent
Reactotron - A Debugging AgentMatthieu Vachon
 
Scaling asp.net websites to millions of users
Scaling asp.net websites to millions of usersScaling asp.net websites to millions of users
Scaling asp.net websites to millions of usersoazabir
 
WebLogic Developer Webcast 5: Troubleshooting and Testing with WebLogic, Soap...
WebLogic Developer Webcast 5: Troubleshooting and Testing with WebLogic, Soap...WebLogic Developer Webcast 5: Troubleshooting and Testing with WebLogic, Soap...
WebLogic Developer Webcast 5: Troubleshooting and Testing with WebLogic, Soap...Jeffrey West
 
Overview of Microsoft .Net Remoting technology
Overview of Microsoft .Net Remoting technologyOverview of Microsoft .Net Remoting technology
Overview of Microsoft .Net Remoting technologyPeter R. Egli
 
Behind the scenes of Real-Time Notifications
Behind the scenes of Real-Time NotificationsBehind the scenes of Real-Time Notifications
Behind the scenes of Real-Time NotificationsGuillermo Mansilla
 
Socket.IO - Alternative Ways for Real-time Application
Socket.IO - Alternative Ways for Real-time ApplicationSocket.IO - Alternative Ways for Real-time Application
Socket.IO - Alternative Ways for Real-time ApplicationVorakamol Choonhasakulchok
 
Web sockets in Angular
Web sockets in AngularWeb sockets in Angular
Web sockets in AngularYakov Fain
 
Kadecot APIs overview
Kadecot APIs overviewKadecot APIs overview
Kadecot APIs overviewsonycsl
 

Similar to socket.io on SmartFx (20)

Going real time with Socket.io
Going real time with Socket.ioGoing real time with Socket.io
Going real time with Socket.io
 
Html5 websockets
Html5 websocketsHtml5 websockets
Html5 websockets
 
Vert.x for Microservices Architecture
Vert.x for Microservices ArchitectureVert.x for Microservices Architecture
Vert.x for Microservices Architecture
 
Web-Socket
Web-SocketWeb-Socket
Web-Socket
 
Distributed objects
Distributed objectsDistributed objects
Distributed objects
 
Rapid Network Application Development with Apache MINA
Rapid Network Application Development with Apache MINARapid Network Application Development with Apache MINA
Rapid Network Application Development with Apache MINA
 
RMI (Remote Method Invocation)
RMI (Remote Method Invocation)RMI (Remote Method Invocation)
RMI (Remote Method Invocation)
 
Real time coding with jWebSocket
Real time coding with jWebSocketReal time coding with jWebSocket
Real time coding with jWebSocket
 
Behind the scenes of Scaleway Functions : when Kubernetes meets our products
Behind the scenes of Scaleway Functions : when Kubernetes meets our productsBehind the scenes of Scaleway Functions : when Kubernetes meets our products
Behind the scenes of Scaleway Functions : when Kubernetes meets our products
 
Reactotron - A Debugging Agent
Reactotron -  A Debugging AgentReactotron -  A Debugging Agent
Reactotron - A Debugging Agent
 
Scaling asp.net websites to millions of users
Scaling asp.net websites to millions of usersScaling asp.net websites to millions of users
Scaling asp.net websites to millions of users
 
Power ai image-pipeline
Power ai image-pipelinePower ai image-pipeline
Power ai image-pipeline
 
WebLogic Developer Webcast 5: Troubleshooting and Testing with WebLogic, Soap...
WebLogic Developer Webcast 5: Troubleshooting and Testing with WebLogic, Soap...WebLogic Developer Webcast 5: Troubleshooting and Testing with WebLogic, Soap...
WebLogic Developer Webcast 5: Troubleshooting and Testing with WebLogic, Soap...
 
Overview of Microsoft .Net Remoting technology
Overview of Microsoft .Net Remoting technologyOverview of Microsoft .Net Remoting technology
Overview of Microsoft .Net Remoting technology
 
17-Networking.pdf
17-Networking.pdf17-Networking.pdf
17-Networking.pdf
 
Behind the scenes of Real-Time Notifications
Behind the scenes of Real-Time NotificationsBehind the scenes of Real-Time Notifications
Behind the scenes of Real-Time Notifications
 
Socket.IO - Alternative Ways for Real-time Application
Socket.IO - Alternative Ways for Real-time ApplicationSocket.IO - Alternative Ways for Real-time Application
Socket.IO - Alternative Ways for Real-time Application
 
Socket.io
Socket.ioSocket.io
Socket.io
 
Web sockets in Angular
Web sockets in AngularWeb sockets in Angular
Web sockets in Angular
 
Kadecot APIs overview
Kadecot APIs overviewKadecot APIs overview
Kadecot APIs overview
 

Recently uploaded

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 

Recently uploaded (20)

Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 

socket.io on SmartFx

  • 2. CONTENTS  What is SmartFX?  Coding Hints for the usage of Socket.IO  Considerations on using Socket.IO  The Middleware, Socket.IO-ReqEv  Operation of Socket.IO server  Redundancy and load balancing  Shutdown in case of deploy
  • 4. What is SmartFX?  A free site for smartphone developed by Minkabu to provide FX information including news, charts and predictions  A real-time Single Page Application based on Socket.IO and Backbone.js Go to - http://smartfx.jp or real URL http://smartfx.minkabu.jp
  • 5. Coding Hints for the usage of Socket.IO
  • 6. Considerations on using Sockeet.IO  Socket.IO has powerful Socket managing tools of “NameSpace”, “Rooms” and “Events”  Their interchangeable feature, there's more than one way to manage a broadcast client.  We, therefore, introduced our own coding rules in SmartFX
  • 7. Coding Rules in SmartFX  One Object for One NameSpace  One Event for One Room with One EventName  Each event shall be emitted using Room feature  Define 3 Types of Event of “message”, ”reply” and ”error”  “message” shall be used for the data transfer from a client to the server  “reply” and ”error” shall be used for from the server to a client
  • 8. The Middleware, Stock.IO-ReqEv  With coding rules, succeeded to create a Middleware with specialized feature of Stock.IO procedures  We named the Middleware “Socket.IO-ReqEv”  You can install below npm install socket.io-reqev
  • 9. How to use Socket.IO-ReqEv -the server side- Only 2 steps 1. Create a IOReqEv object with an initial value of a Socket.IO object. 2. Call “register” method giving NameSpace & object met with the rule of IO-ReqEv *Example above shows the simplest case of one set of registration. This “register” method can be called repeatedly.
  • 10. Rules to pass objects to Socke.IO- ReqEv 1. Set event name to the property of array “events” 2. Emit event with data, inheriting EventEmitter 3. Implement a method “request”, which Socket.IO-ReqEv calls when a message from client includes a parameter of “requests” . This works similar to HTTP GET *Codes on the left runs to broadcast events every second/minute and emit the current time
  • 11. How to use Socket.IO-ReqEv -the client side- Only 2 steps on browser 1. Create IOReqEvClient, giving the url which includes the address of Socket.IO and namespace, and callback 2. Call a method “watch” to subscribe an event and to get a request *unsubscribe automatically unnecessary events previously called, once the method “watch” is called again with another events
  • 12. Implementation of Socket.IO-ReqEv  The library of Socket.IO-ReqEv is written with just less than 60 coding lines  Moreover, the library is written with public properties only on Socket.IO 1.0, while there were some non- public properties on 0.9.x  The source code of Socket.IO-ReqEv is available at url below https://github.com/takeshy/socket.io-reqev
  • 15. Redundancy and Load Balancing  Redundancy and load balancing are accomplished-  Socket.IO server updates its record on the DB periodically  WebServer gets a list of address of Socket.IO server recently updated from the DB  WebServer Returns one of them randomly to a client
  • 16. Redundancy and Load Balancing Sequences
  • 17. Shutdown in case of Deploy  Delete command in demon management tool of pm2 does not work under the situation of Socket.IO being always connected to client  To solve this problem, developed a self-shutdown mechanism of Socket.IO server
  • 18. The Workflow of Deploy  Update app source code in the Socket.IO server, and run the script which executes pm2 command of “delete” and “start”. (by capistrano)  Set “inactive” to the status field of the Socket.IO record on the DB  Once the Socket.IO detects its own record set as “inactive”, the server broadcasts inactive event to clients and set timer to kill itself a minute later  A client which received inactive event displays a popup message saying “disconnected the server” in case the user stays more than 1 minute. (in case a user goes to different page, the client gets another server address, then network connection stays)  Set “activate” to the status field of the Socket.IO record on the DB