Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #33034

Re: Which type of network access for this situation?

From Stefan Weiss <krewecherl@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: Which type of network access for this situation?
Date 2017-04-18 01:57 +0200
Organization albasani.net
Message-ID <od3kp9$mr9$1@news.albasani.net> (permalink)
References <7e444aec-2938-4da7-9162-54b71bbe7be7@googlegroups.com>

Show all headers | View raw


bit-naughty@hotmail.com wrote:
> Suppose after a page is loaded, I want to download some stuff (text or
> HTML) later, or even immediately and display it. But NOT on a button click,
> more like say, after a timer goes off or something. What type of networking
> shit do I use for this? Does it call for AJAX, WebSockets or the DataChannel
> part of the WebRTC API, which I just got to know about? I'm still not really
> clear about what the exact differences between each of them are....

Use the XMLHttpRequest object.

There's a simple example at the top of this page:
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest

To really understand the differences between the "networking shit" you
mentioned, you'll have to read some documentation (or at least skim their
Wikipedia entries, to get a rough overview).

In a nutshell:

* XMLHttpRequest ("AJAX"): HTTP request/response based, easy to use, your
  method of choice unless you have a very good reason to choose something
  else.

* WebSockets: powerful two-way communication method, can be used to
  implement complex interactions between a server and a client. Once
  opened, a socket stays open, allowing the server to send data to the
  client without getting a request. The WebSockets only provide the
  transport, you are responsible for designing the data exchange protocol.

* WebRTC: a new-ish technology optimized for audio/visual data interchange;
  enables peer-to-peer connections. Use this if you want to build your own
  Skype.


- stefan

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Which type of network access for this situation? bit-naughty@hotmail.com - 2017-04-17 11:53 -0700
  Re: Which type of network access for this situation? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-04-18 00:57 +0100
  Re: Which type of network access for this situation? Stefan Weiss <krewecherl@gmail.com> - 2017-04-18 01:57 +0200
    Re: Which type of network access for this situation? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-04-18 02:52 +0200
      Re: Which type of network access for this situation? Stefan Weiss <krewecherl@gmail.com> - 2017-04-18 03:13 +0200
        Re: Which type of network access for this situation? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-04-18 05:40 +0200
        Re: Which type of network access for this situation? bit-naughty@hotmail.com - 2017-04-18 08:22 -0700
          Re: Which type of network access for this situation? bit-naughty@hotmail.com - 2017-04-18 08:28 -0700
          Re: Which type of network access for this situation? Jon Ribbens <jon+usenet@unequivocal.eu> - 2017-04-18 16:08 +0000
            Re: Which type of network access for this situation? bit-naughty@hotmail.com - 2017-04-19 23:44 -0700
              Re: Which type of network access for this situation? Jon Ribbens <jon+usenet@unequivocal.eu> - 2017-04-20 10:15 +0000
                Re: Which type of network access for this situation? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-04-20 12:56 +0200
  Re: Which type of network access for this situation? maherrj@googlemail.com - 2017-04-17 17:23 -0700
  Re: Which type of network access for this situation? Stefan Weiss <krewecherl@gmail.com> - 2017-04-18 03:29 +0200

csiph-web