github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/doc/content/ru/docs/plugins/notify/webpush.md (about)

     1  
     2  ---
     3  title: "Push уведомления"
     4  linkTitle: "webpush"
     5  date: 2022-06-08
     6  description: >
     7  
     8  ---
     9  
    10  Web push — это короткие сообщения, которые smart home отправляет в браузер, чтобы сообщить о какой-либо важной информации. Они показываются даже тем, кто ушел с сайта, и не требуют указания почты или телефона.
    11  
    12  
    13  ### Настройка
    14  * public key
    15  * private key
    16  
    17  ### Атрибуты
    18  * userIDS
    19  * title
    20  * body
    21  
    22  ### javascript свойства
    23  
    24  ----------------
    25  
    26  ### Новое сообщение
    27  
    28  создает объект сообщения
    29  
    30  ```coffeescript
    31  msg = notifr.newMessage();
    32  msg.type = 'webpush';
    33  msg.attributes = {
    34    'userIDS': '14',
    35    'title': 'Lorem Ipsum is simply',
    36    'body': 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum'
    37  };
    38  
    39  ```
    40  |  значение  | описание  |
    41  |-------------|---------|
    42  | newMessage() |    метод   |
    43  | msg |   type: Object (Message)  |
    44  
    45  ----------------
    46  
    47  ### пример кода
    48  
    49  ```coffeescript
    50  # webpush
    51  # ##################################
    52  sendMsg =()->
    53    msg = notifr.newMessage();
    54    msg.type = 'webpush';
    55    msg.attributes = {
    56      'userIDS': '14',
    57      'title': 'Lorem Ipsum is simply',
    58      'body': 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum'
    59    };
    60    notifr.send(msg);
    61  
    62  sendMsg()
    63  ```
    64