samdutton / simpl

Simplest possible examples of HTML, CSS and Javascript:
https://simpl.info
Apache License 2.0
5.19k stars 1.64k forks source link

How is this suppose to communicate to another web browser page? #177

Open DCWizard opened 1 year ago

DCWizard commented 1 year ago

All I see in this demo is communicating to itself. That makes this kind of useless, don't u think?

samdutton commented 1 year ago

It is indeed useless :) but that's intentional: the demo is only meant to show how the API works, as simply as possible.

Instead, you might want to have a go at the WebRTC codelab, which can definitely be adapted to build something non-useless.

(Caveat: I haven't worked on WebRTC for several years, and I don't know how up-to-date the codelab is. It should be in reasonable shape, but if you have problems or questions, the webrtc-discuss newsgroup is a good place to ask.)

DCWizard commented 1 year ago

Thanks for the pointers. Maybe you can point me even more in the right direction. Do I even need WebRTC in a first place? I just need to send command between two or more web browser pages. Ideally, one web page as a Socket server listening and the other as socket client would do the trick in a normal Application.

I' have been tackling this for a few days. seems all over bloated and not working. And the ICE is just as effective as the real adjacency.


From: Sam Dutton @.> Sent: January 17, 2023 5:37 AM To: samdutton/simpl @.> Cc: DCWizard @.>; Author @.> Subject: Re: [samdutton/simpl] How is this suppose to communicate to another web browser page? (Issue #177)

It is indeed useless :) but that's intentional: the demo is only meant to show how the API works, as simply as possible.

Instead, you might want to have a go at the WebRTC codelabhttps://codelabs.developers.google.com/codelabs/webrtc-web#0, which can definitely be adapted to build something non-useless.

(Caveat: I haven't worked on WebRTC for several years, and I don't know how up-to-date the codelab is. It should be in reasonable shape, but if you have problems or questions, the webrtc-discuss newsgrouphttps://groups.google.com/g/discuss-webrtc is a good place to ask.)

— Reply to this email directly, view it on GitHubhttps://github.com/samdutton/simpl/issues/177#issuecomment-1385187610, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUI7EHIL5D7VXNLWIGOBD4TWSZY5FANCNFSM6AAAAAAT5HWQUU. You are receiving this because you authored the thread.Message ID: @.***>

samdutton commented 1 year ago

For same origin, you might want to try BroadcastChannel https://developer.chrome.com/blog/broadcastchannel/ (MDN https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API). (There are some other suggestions here https://blog.bitsrc.io/4-ways-to-communicate-across-browser-tabs-in-realtime-e4f5f6cbedca .)

Across different origins, you could use something based on WebSocket https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API (though, of course, that needs an intermediary server). I've used Socket.IO https://socket.io/ in the past, but ws https://github.com/websockets/ws and other alternatives are very popular.

On Wed, 18 Jan 2023 at 06:17, DCWizard @.***> wrote:

Thanks for the pointers. Maybe you can point me even more in the right direction. Do I even need WebRTC in a first place? I just need to send command between two or more web browser pages. Ideally, one web page as a Socket server listening and the other as socket client would do the trick in a normal Application.

I' have been tackling this for a few days. seems all over bloated and not working. And the ICE is just as effective as the real adjacency.


From: Sam Dutton @.> Sent: January 17, 2023 5:37 AM To: samdutton/simpl @.> Cc: DCWizard @.>; Author @.> Subject: Re: [samdutton/simpl] How is this suppose to communicate to another web browser page? (Issue #177)

It is indeed useless :) but that's intentional: the demo is only meant to show how the API works, as simply as possible.

Instead, you might want to have a go at the WebRTC codelab< https://codelabs.developers.google.com/codelabs/webrtc-web#0>, which can definitely be adapted to build something non-useless.

(Caveat: I haven't worked on WebRTC for several years, and I don't know how up-to-date the codelab is. It should be in reasonable shape, but if you have problems or questions, the webrtc-discuss newsgroup< https://groups.google.com/g/discuss-webrtc> is a good place to ask.)

— Reply to this email directly, view it on GitHub< https://github.com/samdutton/simpl/issues/177#issuecomment-1385187610>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AUI7EHIL5D7VXNLWIGOBD4TWSZY5FANCNFSM6AAAAAAT5HWQUU

. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/samdutton/simpl/issues/177#issuecomment-1386546662, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABSDKVM7MUNQ233FULHCZ3WS6DIHANCNFSM6AAAAAAT5HWQUU . You are receiving this because you commented.Message ID: @.***>

DCWizard commented 1 year ago

Thanks, that's what I thought when looking inside libs. Seems that no matter what I used. It always need an external server. Which is what I was trying to avoid. I am on a shared server. I have no need for same origins.

Some say that having a port listener directly in the browser would be a major security threat. I don't understand that. How? Can you give an example ?

Replied from my phone.


From: Sam Dutton @.> Sent: January 19, 2023 5:43 AM To: samdutton/simpl @.> Cc: DCWizard @.>; Author @.> Subject: Re: [samdutton/simpl] How is this suppose to communicate to another web browser page? (Issue #177)

For same origin, you might want to try BroadcastChannel https://developer.chrome.com/blog/broadcastchannel/ (MDN https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API). (There are some other suggestions here https://blog.bitsrc.io/4-ways-to-communicate-across-browser-tabs-in-realtime-e4f5f6cbedca .)

Across different origins, you could use something based on WebSocket https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API (though, of course, that needs an intermediary server). I've used Socket.IO https://socket.io/ in the past, but ws https://github.com/websockets/ws and other alternatives are very popular.

On Wed, 18 Jan 2023 at 06:17, DCWizard @.***> wrote:

Thanks for the pointers. Maybe you can point me even more in the right direction. Do I even need WebRTC in a first place? I just need to send command between two or more web browser pages. Ideally, one web page as a Socket server listening and the other as socket client would do the trick in a normal Application.

I' have been tackling this for a few days. seems all over bloated and not working. And the ICE is just as effective as the real adjacency.


From: Sam Dutton @.> Sent: January 17, 2023 5:37 AM To: samdutton/simpl @.> Cc: DCWizard @.>; Author @.> Subject: Re: [samdutton/simpl] How is this suppose to communicate to another web browser page? (Issue #177)

It is indeed useless :) but that's intentional: the demo is only meant to show how the API works, as simply as possible.

Instead, you might want to have a go at the WebRTC codelab< https://codelabs.developers.google.com/codelabs/webrtc-web#0>, which can definitely be adapted to build something non-useless.

(Caveat: I haven't worked on WebRTC for several years, and I don't know how up-to-date the codelab is. It should be in reasonable shape, but if you have problems or questions, the webrtc-discuss newsgroup< https://groups.google.com/g/discuss-webrtc> is a good place to ask.)

— Reply to this email directly, view it on GitHub< https://github.com/samdutton/simpl/issues/177#issuecomment-1385187610>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AUI7EHIL5D7VXNLWIGOBD4TWSZY5FANCNFSM6AAAAAAT5HWQUU

. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/samdutton/simpl/issues/177#issuecomment-1386546662, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABSDKVM7MUNQ233FULHCZ3WS6DIHANCNFSM6AAAAAAT5HWQUU . You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHubhttps://github.com/samdutton/simpl/issues/177#issuecomment-1396769581, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUI7EHN36BBTJ65FZCIMYGDWTELD5ANCNFSM6AAAAAAT5HWQUU. You are receiving this because you authored the thread.Message ID: @.***>