W3cubDocs

/DOM

PushSubscription.endpoint

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

PushSubscription 의 읽기 전용 속성인 endpoint 는 push subscription 과 연관있는 endpoint 값을 USVString 형태로 반환한다.

endpoint 는 push 서버를 가리키는 커스텀 url 형태를 매개변수로 갖고, 이 커스텀 url은 푸쉬 서비스에 등록되어 있는 특정 서비스워커 인스턴스에 푸쉬 메시지를 보낼 때 사용한다. 이러한 이유로, endPoint 는 다른 사람들이 중간에 가로채서 push 기능을 남용하지 않도록 비공개 형태로 지니고 있는 것이 좋다.

Syntax

var myEnd = pushSubscription.endpoint;

Value

A USVString.

Example

navigator.serviceWorker.ready.then(function(reg) {
  reg.pushManager.subscribe({userVisibleOnly: true}).then(function(subscription) {
    console.log(subscription.endpoint);

      // At this point you would most likely send the subscription
      // endpoint to your server, save it, then use it to send a
      // push message at a later date
  })
})

Specifications

Specification Status Comment
Push API
The definition of 'endPoint' in that specification.
Working Draft Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 42.0 44.0 (44.0)[1] No support ? No support
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support No support No support 48.0 (48)[2] No support No support No support No support 42.0

See also

© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription/endpoint