Same BentoolsWebPushClient object with multiple application instance
Closed this issue · 3 comments
Hi @bpolaszek,
I have two application where I use your bundle and I have found a problem using the same naming convention for route. One application is available on url https://dev.orocrm.sinabs.fr/, the other on https://oro.sinabs.fr.
The problem is that I have got the same object BentoolsWebPushClient created on my browser when I visit both pages, then my browser consider that I have already subscribe to notification.
I suggest to replace the path
function by url
function in Twig template during configuration in order to create object with absolute URL not a relative one.
<script src="{{ asset('bundles/webpush/js/webpush_client.js') }}" data-webpushclient></script>
<script>
var webpush = new BenToolsWebPushClient({
serverKey: '{{ bentools_pusher.server_key | e('js') }}',
url: '{{ url('bentools_webpush.subscription') }}'
});
</script>
Hello @AdriwanKenoby,
That's a good catch. Have you tried it and do you confirm that it works as expected?
It seems that is working now as expected.
Perfect. If you don't mind opening a PR on 03 - Configuration.md I would feel less alone on this repository 😅