Push model

from Wikipedia, the free encyclopedia

In application programming, the push model is a design pattern for data transmission in which the data provider monitors the data. If this recognizes changes, it sends the changed values ​​to the data receiver. The receiver behaves passively and waits for new values after it has logged on according to the observer pattern . The opposite is the pull model .

Advantages:

  • Data is only transferred if values ​​have actually changed.
  • The sender can send the data immediately after the value has changed and therefore does not require any additional buffers.

Disadvantage:

  • The data supplier needs evaluation logic for the change detection.
  • If a value is lost during transmission, the sender and receiver are asynchronous. This asynchronicity is only corrected with the next change in value.

Application examples

Web push

The Internet Engineering Task Force's web push proposal is a simple protocol that used HTTP version 2 to convey real-time events such as incoming calls or messages that can be delivered (or "pushed") in a timely manner. The protocol consolidates all real-time events into a single session, which ensures more efficient use of network and radio resources. A single service consolidates all events and distributes these events to the applications as they occur. This only requires a single session, which avoids double overhead costs. Web notifications are part of the W3C standard and define an API for end user notifications. A notification enables the user to be informed about an event such as a B. the delivery of e-mails. As part of this standard push API defined by the W3C, it was implemented by the Chrome, Firefox, Edge and Safari web browsers.

HTTP server push

HTTP server push (also known as HTTP streaming) is a mechanism for sending unwanted (asynchronous) data from a web server to a web browser. HTTP server push can be achieved through one of several mechanisms.

As part of HTML5, the WebSocket API enables a web server and client to communicate over a full-duplex TCP connection.

In general, the web server does not terminate a connection after sending response data to a client. The web server leaves the connection open so that if an event occurs (e.g. a change in internal data that has to be reported to one or more clients), it can be sent immediately; otherwise the event would have to be queued until the next request from the client is received. Most web servers offer this functionality via CGI (e.g. non-parsed header scripts on Apache HTTP Server). The underlying mechanism for this approach is chunked transfer coding.

Another mechanism is related to a special MIME type called multipart / x-mixed-replace introduced by Netscape in 1995. Web browsers interpret it as a document that changes as soon as the server pushes a new version to the client. It is still supported by Firefox, Opera and Safari today, but ignored by Internet Explorer and only partially supported by Google Chrome. It can be applied to HTML documents and also for streaming images in webcam applications.

The proposal WHATWG Web Applications 1.0 contains a mechanism to push content to the client. On September 1, 2006, the Opera web browser implemented this new experimental system in a function called "Server-Sent Events", which is now being standardized as part of HTML5.

Push notification

A push notification is a message that is "pushed" by the backend server or an application to the user interface, e.g. B. (but not limited to) mobile applications and desktop applications. Apple first introduced push notifications in 2009.

In 2010, Google released its own service, Google Cloud to Device Messaging. It has since been replaced by Google Cloud Messaging and then Firebase Cloud Messaging.

November 2015, Microsoft announced that the Windows Notification Service would be expanded to take advantage of the Windows platform architecture, allowing push notifications to Windows 10 , Windows 10 Mobile , Xbox, and other supported platforms with universal API calls and POST Requests can be sent.

Push notifications are mainly divided into 2 approaches, local notifications and remote notifications.

  1. With local notifications, the application schedules the notification with the operating system of the local device or, alternatively, sets it as a timer in the application itself, if it can run continuously in the background. When the scheduled time of the event is reached or the programmed condition of the event is met, the message is displayed in the application user interface.
  2. Remote notifications are handled through a remote server. In this scenario, the client application must be registered on the server with a unique key (such as a UUID ). The server then sends the message against the unique key in order to transmit the message to the client application via an agreed client / server protocol such as HTTP or XMPP , and the client displays the received message. When the push notification arrives, it can deliver short notifications and messages, put badges on application icons, keep the notification LED blinking or lit continuously, or play warning tones to get users' attention. Push notifications are typically used by applications to draw users' attention to information. The content of the messages can be divided into the following example categories:
    •    Chat messages, e.g. E.g. messages from Facebook Messenger that are sent by other users.
    •    Supplier special offers, for example: A supplier may want to advertise their social offers to customers.
    •    Event reminder, for example: An application can allow the customer to set a reminder or alarm for a specific time.
    •    Subscribed topics change, for example: users may want to receive updates regarding the weather at their location or monitor a web page to track changes

Real-time push notifications can raise privacy issues as they can be used to create a link between virtual identities from social network pseudonyms to the real identities of smartphone owners.

literature

Frank Buschmann, Regine Meunier, Hans Rohnert, Peter Sommerlad, Michael Stal : Pattern-oriented Software Architecture . John Wiley & Sons , Chichester / New York 1996, ISBN 0-471-95869-7 .

Individual evidence

  1. Elio Damaggio, Martin Thomson, Brian Raymor: Generic Event Delivery Using HTTP Push. Retrieved May 1, 2020 .
  2. Web Notifications. Retrieved May 1, 2020 .
  3. Push API. Retrieved May 1, 2020 .
  4. ^ CGI Programming on the World Wide Web. Chapter 6 - 6.6 Animation. O'Reilly & Associates, accessed May 1, 2020 .
  5. GoDaddy: http://victor.transformadora.com/Oreilly/wdesign/xhtml/ch13_03.htm. Retrieved May 1, 2020 .
  6. 249132 - chromium - An open-source project to help move the web forward. - monorail. Retrieved May 1, 2020 .
  7. The Opera Blog - News | Opera. Retrieved May 1, 2020 (American English).
  8. ^ Opera Watch - Opera takes the lead with AJAX support among browsers: More efficient streaming. March 18, 2007, accessed May 1, 2020 .
  9. iPhone push notification service for devs announced. Retrieved May 1, 2020 .
  10. Google Cloud Messaging for Android (GCM) Unveiled, to Replace C2DM Framework. Retrieved May 1, 2020 .
  11. GrantMeStrength: Windows Push Notification Services (WNS) overview - UWP applications. Retrieved May 1, 2020 (American English).
  12. Local and Remote Notification Programming Guide: Local and Remote Notifications Overview. Retrieved May 1, 2020 .
  13. Information about Push Notifications for iOS and Android. February 19, 2019, accessed May 1, 2020 (American English).
  14. How can I customize my Facebook mobile push notifications? | Facebook Help Center | Facebook. Retrieved May 1, 2020 .