1 00:00:04,630 --> 00:00:09,240 In the previous lesson we discussed HTP teus a server push feature. 2 00:00:09,340 --> 00:00:16,950 So with our server having HTP to enable Let's see a very quick example of how we might use server push. 3 00:00:16,960 --> 00:00:23,260 Note that the subject of server push can be quite extensive and very quickly creep into web development 4 00:00:23,500 --> 00:00:25,240 rather than networking. 5 00:00:25,240 --> 00:00:28,270 Therefore I'll keep this lesson very simple. 6 00:00:28,270 --> 00:00:32,740 I have however linked to some more documentation and guides in the lesson resources. 7 00:00:32,860 --> 00:00:34,510 Should you wish to learn more. 8 00:00:34,870 --> 00:00:41,100 I have the demo site open in my browser and to get a better idea of how this loads at the moment open 9 00:00:41,110 --> 00:00:48,250 the Developer Tools disabling the browser cache here just to ensure we're getting an actual server response 10 00:00:48,760 --> 00:00:55,480 reload and we get the three resources on this page indexed not actually amelle first being the main 11 00:00:55,480 --> 00:01:03,700 request which the browser passes and finds links to both style Dotti assess and thumb not be in G the 12 00:01:03,700 --> 00:01:11,200 browser requests those resources and they are delivered simultaneously over a multiplexed HTP to connection. 13 00:01:11,380 --> 00:01:17,650 What we can do with a server push implementation then is send these two files style dotsie assess and 14 00:01:17,650 --> 00:01:23,260 thumb dot P and G along with this response for indexed age dear mal. 15 00:01:23,260 --> 00:01:29,050 Note however that these browser tools isn't particularly good at displaying how pushed files are delivered. 16 00:01:29,050 --> 00:01:33,940 So instead I'll use a command line tool called N G H T T P. 17 00:01:34,150 --> 00:01:39,010 This is available for all Linux distributions or even for your local development machine. 18 00:01:39,010 --> 00:01:40,830 Should you wish to it from there. 19 00:01:41,020 --> 00:01:51,550 But to install it here on a one to using a p t I'll run apt get install n g h t t to client. 20 00:01:52,920 --> 00:01:57,430 Yes and done so detest our current implementation. 21 00:01:57,450 --> 00:01:58,070 I'll say. 22 00:01:58,080 --> 00:01:59,970 N G H T T B. 23 00:02:00,090 --> 00:02:01,910 With a couple of flags. 24 00:02:02,050 --> 00:02:05,060 N to discard the responses. 25 00:02:05,070 --> 00:02:08,890 Meaning we're only testing them and not saving them to disk. 26 00:02:09,050 --> 00:02:15,280 Why to ignore the self science certificate and S meaning print the response. 27 00:02:15,330 --> 00:02:16,600 Statistics. 28 00:02:16,620 --> 00:02:19,150 Which is exactly what we're interested in. 29 00:02:19,210 --> 00:02:24,350 Post that indexed out h.t. email you are role enter and we see here. 30 00:02:24,390 --> 00:02:28,480 A simple response breakdown confirming that only indexed. 31 00:02:28,530 --> 00:02:30,370 The email was downloaded. 32 00:02:30,660 --> 00:02:33,570 Do that same test again this time. 33 00:02:33,570 --> 00:02:40,710 Adding in a flag meaning also request linked assets for this request so styled as is and fund or be 34 00:02:40,800 --> 00:02:42,620 injy enter. 35 00:02:42,810 --> 00:02:48,300 And again as with the browser we see from the timings that these two files were requested and downloaded 36 00:02:48,330 --> 00:02:55,020 at the same time immediately after receiving indexed HD email what we want to achieve then is to run 37 00:02:55,020 --> 00:02:56,190 the first test. 38 00:02:56,250 --> 00:03:02,760 So not requesting these two linked files but still receive them as a result of requesting indexed Odd 39 00:03:02,760 --> 00:03:06,970 h.t. a mile over to the engine configuration file. 40 00:03:07,290 --> 00:03:09,200 I'll add a new location. 41 00:03:09,390 --> 00:03:13,260 Make this an exact match for indexed HD Mel. 42 00:03:13,440 --> 00:03:19,620 Very importantly however slash indexed h.t. email exactly as we're requesting it. 43 00:03:19,620 --> 00:03:30,600 In which case will perform an H TTP to underscore push or slash style dotsie Yes and the same for Slash 44 00:03:30,710 --> 00:03:31,160 thumb. 45 00:03:31,170 --> 00:03:32,700 Don't be in G. 46 00:03:33,280 --> 00:03:39,490 That's very rudimentary but essentially all we need to push these two files when indexed hard edged 47 00:03:39,490 --> 00:03:41,290 here mail is requested. 48 00:03:41,290 --> 00:03:47,800 Note that we are not specifying the resource itself but rather the request for the resource. 49 00:03:47,910 --> 00:03:50,210 An important distinction. 50 00:03:50,290 --> 00:03:53,460 Save reload the configuration. 51 00:03:54,340 --> 00:03:57,370 Run that first test with out the a flag. 52 00:03:57,460 --> 00:04:05,050 So the one that only gave us indexed updated here Mal enter and this time we get all three files automatically 53 00:04:05,410 --> 00:04:08,740 with this asterisk indicating a pushed response. 54 00:04:08,740 --> 00:04:14,920 Also note the significant reduction in process times and the total time for these linked resources to 55 00:04:14,920 --> 00:04:16,060 be received. 56 00:04:16,420 --> 00:04:22,750 So overall a much faster and more efficient way of delivering Web based content for both the server 57 00:04:22,840 --> 00:04:24,250 and the client.