Bestand wählen
Merken

Using Service Workers in Ember

Zitierlink des Filmsegments
Embed Code

Automatisierte Medienanalyse

Beta
Erkannte Entitäten
Sprachtranskript
and the everyone I think we had started here so
I talk to you by using service workers number it was mentioned the keynote and let me start
off by saying I am really excited about service workers I mean I am freakin excited just like my friend Chris wake here and and here's why so I believe that service workers are the next evolution in what we can do in a browser if you think back to the early 2 thousands when XHR came out and it really change the landscape of what a web that B of of I believe were at that scene of vantage point now where we're going to see service workers really change what we can do with the web apps that so let me start by telling you how faster working with such workers so for
me it all started with kids like the ones you see here as so I work for a non-profit called cure national and we provide life-saving care but 2 kids in 30 countries in the developing world and for like the last 6 years we've been developing innovative technology solutions including like rural time reporting of our kids in the hospitals and but we realize we're missing something as an essential full crossed a network and that was a hospital information
system that we needed something so you provide better oversight of the care taking place in our hospitals and clinics and historically the way we've kept track of everything is through paper records the bank get loaded into these bins you see here and are transported remote clinics on its can really clunky and as a technologist and knowing a lot better at
work in the developing world we also have answer the challenges and most challenging thing is Internet activity so in some locations can activity is either poor or nonexistent so when we examine existing solutions for a hospital information system we couldn't find anything out there that really solve developing-world challenges us so we decidable learn and we don't something called
hospital run it's at hospital information system built for the developing world prosperous the developing world and it's an open source solution uh that we built for the approximately 14 thousand hospitals in the developing world that need a solution like this that we build a without the of course but would build for offline and online use and we have an intentional folks and usability so when service workers became available it became immediately clear to me that they were something that we could that would be very useful that for hospital run so as I talk about service workers only highlighting its having been helpful in our project as well as to call out I use is another at Member applications so let me start off with what's the
service of water service workers I'm it was mentioned that you know you may know some things about them but let's read what the spexs the spexs this is a method that enables applications to take advantage of persistent background processing including hooks to enable bootstrapping of web applications while offline so the down of that of so the 2nd part of definition
says that it's a bootstrapping of web application for offline city furnaces orders before you probably have heard this offline story but and in fact 1 of the key features of service workers is that they allow your after on offline but to say that service work 16 and service workers however were not the 1st browser feature to ID do this our friend AP
hash which has been reference already and is such a wonderful thing I'm is was the factor way of doing offline and in fact as was going down keynote is still the weights to offline but there is a lot of pain points in and a lot of that has to with the fact that it's a decorative there's a really I'm give you the control that you need and service workers were panic created in part as a response to the horrible list of application cash at the just talking about offline with service workers is just skimming the surface were just getting started here so service workers
really give you as a developer the power that so 1 way to think of a service workers as this network proxy that allows you to control what happens with every network request and because service workers are allowing you to interface the network level you can run them on top existing apps but without changing your existing code and so that's an important thing to keep in mind the and there's several complementary browser features that can be service workers and and the important concepts the 1st 1 is the
Cache API so with this API developers have ultimate control of what its cash and when and you can also reach into that cash pull things out at any time you want to so really what you're getting here is what used to be only browser internals is now available to you as a developer and I think that's really awesome another feature that is
complementary to the service workers is batch income I think if X is like XHR with promises that's it gives you the same kind of level of control being of of police from the network and it's the only way of doing it in a service will produce XHR inside of search workers
so getting back to our definition of service workers years apart that i skipped and that's the 1st part the talks about this idea persistent background processing and this is an important thing to remember about service workers are running in the background at what exactly we mean that it's running in the background while 1 service workers were 1st introduced that they were called navigation and taller but that name was changed to include the word worker and that part is very significant because service workers are like web workers in that they run in a separate thread so you figurative put out of application it's single-threaded and this is running a separate thread and this lead us some performance implications of get to in a bit so
because service workers are workers but it means that they're essentially sandbox a running in their own globals grip context you know they don't have direct access to your apps code but they do but they do have ways to communicate outside with post messages and even with the cash API there
is 1 important caveat using service workers and that's that the AGPS only that this doesn't apply for a local those so and involve me not to worry about it and the good news here is anymore we really should be concerned about the cost of each EPS especially when you have a services like let's and cropped any even AWS offering free service we really don't an excuse to not run each guess and more so that's kind of a quick
overview of what service workers are but if you want a more about some the details of search orders that link get into in this talk and I want it mention of all resources the first one is the site is service worker ready this has some great overview information as well as can I. keeping track of in different browsers what features are available and in of the status of thing so it's it's really helpful that way the another useful
resources of Mazzola put together service worker cookbook and they can break down the the different use cases and with these slide Madison and and shave source it's it's really easy way to come learn and behind the scenes out of service workers work so
that I also want mention that they're from developer council is really useful tool I can debug years service were prepared just as easy as any other job script application of give the same tools and the other piece that's in the developer council is a view into the cash now but this is again because catches your a browser internal thing it was a really all that easy to see into it but with the cash API and developer tools you really can come look into it and speaking of debugging and I
controlled by something the other day and it something unexpected happened but so is working on the spread of service workers and the idea that a command refresh I had this habit of hitting like command Schiffer fresh and and I noticed that my service worker and suddenly wasn't available when my was offline and I thought I should like I broke something I really liked is messed of my period what turns out of spec actually says if you do a hard refreshed basically disables a service worker so this is something to keep in mind as a developer the so hopefully that this can give you a high-level understanding what service workers are income landscape but or here's how about service workers number so let's let's start talking about that so
last year time they also this that service workers should be something that Amber apps get basically for free but I agree and I just happen to be working on something around that time and that
was broccoli service workers so out of the box broccoli service worker will set up the production builds to include a service worker that will make your application available offline they had it's completely free is models and completely free yes so that's properly service worker
so so that's it really like all you need do is insult roughly service worker and you find like in and my talk right now and go have a break will be good well we're not done yet but remember that I said that service workers were created in response the horribleness of application cash and so 1 of it particular main issues with application caches that it didn't give developers as much control over what happened service workers on the other hand are like choose your own
adventure books so when as a kid I remember reading these books that were kind of like a computer game where they can get up part of the story and it would be like if this side like should should Johnny jump through the can through the creator or should he run away and the way he did different outcomes would happen and now I don't remember this 1 about you were shot but it sounds really awesome next year I read the Google reviews on it and 1 his little disappointed is you can only be a shock 3 pages but it still might be an entity January anyway service workers give you as a developer control over what happens so let's us see how we can affect that control with broccoli service workers
so there is several levels of choose your own adventure with about this service worker in the first one is through a simple configuration so in your in your configured file for your app that you can configure some things like pre cashier also so by default your whole act is pre cash that means all your assets so all the Java script images that of thing it's protection if there's additional resources that you wanna pre Kashin always serve them from the catch you can do so the cool thing is because of abruptly service worker is part your build process apart alive related is a new version of the service were gets introduced when you make changes to you don't have to worry about that that that data getting stale and it automatically is a new refreshed so so you can with confidence pre catchable out there's things like I a fallback so like this is the use case here is ever more offline instead of rendering this server go go render the seller 1 and then and then we can use things like network 1st year also so something like an API call where we wanna get the freshest data we can we use a network 1st request and I'm if it can't if it's offline it'll fall back to catch and then this last piece of include files will let us bring in remember of the and service workers script it's it has a different context then you're out so if you need to bring in pieces of the apple work but in this case and bring a past DB on the library I can do that through the can so broccoli service
worker includes Google service worker toolbox and this is really a useful tool in working with service workers and this allows us to express style routing with predefined network strategies so you can see here there's kind of a list of a different network strategies that I are useful in service workers so so you may have the idea that you wanted the freshest C C always give the network 1st but you 1 fall back to cat or maybe the stuff that you just want to be the fastest so that so there's a solution there's a recipe to do that for better fastest data so these options are available to you on through configured so you can to specify these patterns used this these strategies and but if you want the finer grained control out we can actually do
is add files to the service workers directory in your app and any file in the structure will automatically be included in the service worker that's built for so you can add continues the service worker toolbox here to do some heavy lifting involved with service workers or you can roll your own k and so so it's a it's a useful way to to bring in your own code into service worker if you decide you so as I mentioned earlier 1 of the
challenges we face with hospital run is working contacts were Internet connectivity can be bodies to nonexistent but then because this is the case we need to be a brat Hanoi users lack of connected the gracefully and we don't want them to pursue little dinosaur work work or even to to run in this some kind of error situation we want to be able to to handle gracefully and so just adding broccoli service worker let's a app running line but it doesn't say anything about and what we do with data had had we handle that and we need a way to be of a handle the user trying to save war accessdate offline so that in our
case to him was particular issue we had a code to handle specific need not work database calls so we suffer routs where were doing is we intercept that Paul an incentive 1st we try to get from the network and if that whole fails we then pull back to Agrabah from a local pouched DB database and and what's really great about this is the process of seamless to both the user and to your app in the App thinks it's always getting a successful network request you on your offline because all that's handled service worker and I think that's just it blows my mind a little bit that we can do that in a browser these days but it's also so you may be thinking offline isn't something you need to care about I'm hoping after time this keynote you do realize it's something you care about but let me give a couple reasons to think about going offline in your app the 1st thing to think about is
not only your users being offline but what happens when your servers offline be at and you know in DDO s work or just someone screwing up on our servers to go offline occasionally so if we can handle offline and from both the server and the user I think that's a win
a 2nd reason to consider offline is a friend life I know I know we've all experienced this that moment where connected a wife and maybe even at this conference and you don't really have an internet connection we can take that away from our users and I'd suggest we should take away the pain from a user's and also won't need maps have been able to do offline for a while there's not there's still a lot of native apps to do to offline well wiII as web developers have an opportunity to do offline well into giver uses a great experience whether they have a great internet connection where they have really that 1 so maybe
offline isn't a concern for you and but you may be in a situation where you writing mobile apps and you have to worry about 2 g uses your readers who have a throttle connection with the things we do with a service worker is adapt payload based on the network type we we have some information available the browser to say OK what's a current connection so the of fetching 100 records among effects 10 so we do things like that in a service worker it
and along those lines for hospital run we want to be able to monitor response times from the server so some locations the Wi-Fi may not be that great word or Internet connectivity may not be that great but if we can individually monitor for each user OK what's your experience like we gain some metrics to be of a say but there were maybe in the hospitals we needed in improve the Wi-Fi network or we need to make sure that when they go out in the field that they have enough of like a 3 G dongle that they can use to to get that connectivity so so we timeout optionally timeout the response times so so that's kind of looking at service workers make from the network side of things but there are some other things in the news service workers so as I
mentioned earlier that because service workers run in a separate thread there are opportunities to improve performance in service worker so typically I ever applications a single-threaded kind of like this this guy here on but with the service worker language
and the net
mass nouns pretty sure I've never seen a blue screen of death on it had a job was about this fisher number up but the reality is that our outsourcing of threaded and on with a with a service worker were a Web Worker we can use multiple threads interim graph and 1 of the
performance bottlenecks so we hospital run was sinking between this local pouch database in the browser and a couch DB server and it turned out that index the B which is used by pouch TB it blocks the Dom in it can affect performance so it wasn't a great solution so we end up doing was moving
that synchronization into the service worker we immediately self performance gains and in fact here's a quote from known loss and 2 other guys behind prosody and he said yeah I put in a worker it'll he recommends it so I I think that's pretty cool
so some people got really creative about what they're doing service workers and I found this example or someone is running express server inside a service worker so the innosence turning the service were her into a server he could have an app that's basically serverless beyond that that 1st render the on the 1st delivery and and you can do that in a number of today so it's pretty cool at so we've seen some
examples of how service workers can be used in amber apps today as we think about the future of Member in-service workers where are we headed so 1 additional features
of service workers in a warranty that question if occasions and I think this was touched on in the keynote and the thing that were and we have to do here is provide native push notifications to our users try think is pretty cool I'm giving people that that made you feel maybe you may have even seen this facebook is actually using this in production now in it's kind of particles so another forthcoming feature
enabled by service workers is a background sink and the idea here is that actions can be deferred until a user has stable connectivity that so it's particularly in mobile so in this particular example what happens is the user goes offline they send a message while the offline and then they go back line and the message is then sent an and and this provides like a queuing mechanism that certain Member oxygen a benefit from where instead of having to like build some off the shelf queuing mechanism single offline updates the browser will do for you so I think that's that's pretty exciting that's but coming soon to a browser near you but right
now there's not a great way to test service workers in number particularly if it my command line so you know Running a Travis builds a fan and knows nothing about service workers and so it's kind of a gap right now but there the fortunate thing is there's ground working in projects like this service worker unit testing and that I think we take advantage of the number
so as was mentioned in the keynote service workers on in every browser but we're seeing positive traction in the browser vendors Microsoft in particular is working on it and and I have confidence that especially with some the changes that is happening much of that they will end up in getting this done and
operators opera opera arbiters supportive of Safari is considering considering research workers and they've actually indicated in the five-year plan that it's something that they should do now you made some reference to this of you know they may not ever do and in some some days I feel that way but I the more I think about it but I think service workers is such an evolutionary step in browsers that I I do believe down the road of Safari is going to embrace it and and just like AP cash and index DB made their way into safari we will see service workers in and Safari but
this was I think mention keynote as well as the application cache is deprecated in Firefox and they've actually talked about removing support for it so well I think application cash is the way to do things now and it or at least in is the part of a story keep in mind that that that application cash will it at some point go away so we need to think about you know how do we how we build apps that maybe you service worker were possible and then fall back that cash which by the way that Service work respect says that if if a service workers running it all ignore at caches so browser vendors have had kept that in mind and so so really the stories you do both together and and end up with something that's going to cover a thing was it 90 % the brothers the
chronograms following foxes proposal so so the kind following the steps and but such a some keep in mind so lastly when considering
the future of remembrance service workers I really think we need to start thinking about what it means to bring them and and the and I was encouraged by what I heard in in the keynote because I know that Tom you think is important as well so because every data is typically network-centric it seems that it makes sense that we take advantage of the more by threading there up to speed up things service workers and but I think that this sort that we we use service workers in combination with fast to to be able to render things really quickly and then just give a complete offline stories that that really is better than native so that leads me to ask you a
question as you think about what we currently can you service workers what's coming in the near future I want you know I wanna ask you to consider how you can use service workers and perhaps contribute work timbre war and or to additional and browns so as I mentioned again in my talk I believe that service workers are huge evolutionary step forward for browsers and we should be taking advantage of that and 1 more thing so a
hospital run is looking for volunteers to help us build awesome map for the approximately 14 thousand hospitals in the developing world new solution like this so you find it more information hostile on that I know a in your slide that you read or see the hospital bracelet that has a website on its own should forget it so thanks and that's thanks
a and
Web Services
Videokonferenz
Web Services
Code
Zahlenbereich
Demoszene <Programmierung>
Open Source
Benutzerbeteiligung
Punkt
Web Services
Datennetz
Browser
Evolute
Information
Verkehrsinformation
Eins
Internetworking
Weg <Topologie>
Datensatz
Binärdaten
Krankenhausinformationssystem
URL
Physikalisches System
Internetworking
Open Source
Prozess <Physik>
Web Services
Benutzerfreundlichkeit
Wasserdampftafel
Open Source
Mereologie
Bootstrap-Aggregation
Web-Applikation
Krankenhausinformationssystem
Kartesische Koordinaten
Projektive Ebene
Caching
Punkt
Gewicht <Mathematik>
Browser
Bootstrap-Aggregation
Web-Applikation
Kartesische Koordinaten
Mailing-Liste
Teilbarkeit
Web Services
Flächentheorie
Endogene Variable
Hash-Algorithmus
Mereologie
Gamecontroller
Ordnung <Mathematik>
Schlüsselverwaltung
Proxy Server
Hash-Algorithmus
Datennetz
Browser
Code
Übergang
Web Services
Caching
Ablöseblase
Gamecontroller
Softwareentwickler
Hacker
Leistung <Physik>
Bit
Prozess <Physik>
Prozess <Informatik>
Datennetz
Browser
Kartesische Koordinaten
Übergang
Open Source
Benutzerbeteiligung
Web Services
Thread
Mereologie
Gamecontroller
Thread
Wort <Informatik>
Stapelverarbeitung
Chiffrierung
App <Programm>
Freeware
Angewandte Physik
Web Services
Kontextbezogenes System
Prozessautomation
Message-Passing
Offene Menge
Softwareentwickler
Subtraktion
Web Site
Browser
Quellcode
Dienst <Informatik>
Information
Sichtenkonzept
Rechenschieber
Demoszene <Programmierung>
Weg <Topologie>
Message-Passing
Web Services
Information
Ordnung <Mathematik>
Ereignishorizont
Objekt <Kategorie>
Sichtenkonzept
Browser
Zahlenbereich
Sprachsynthese
Kartesische Koordinaten
Frequenz
Open Source
Web Services
Prozess <Informatik>
Gamecontroller
Statistische Analyse
Attributierte Grammatik
Skript <Programm>
Softwareentwickler
Normalvektor
Gammafunktion
Web Services
Videokonferenz
Open Source
Informationsmodellierung
Web Services
Whiteboard
Quader
Installation <Informatik>
Kartesische Koordinaten
Dienst <Informatik>
Biprodukt
Kartesische Koordinaten
Supercomputer
Abenteuerspiel
Homepage
Wechselsprung
Web Services
Computerspiel
COM
Caching
Endogene Variable
Mereologie
Gamecontroller
Kontrollstruktur
Flächeninhalt
Softwareentwickler
Gammafunktion
Subtraktion
Prozess <Physik>
Applet
Mathematisierung
Versionsverwaltung
Dienst <Informatik>
Abenteuerspiel
Web Services
Bereichsschätzung
Datennetz
Mustersprache
Programmbibliothek
Skript <Programm>
Konfigurationsraum
Default
Bildgebendes Verfahren
Web Services
Caching
Roboter
App <Programm>
Addition
Datennetz
Default
Systemaufruf
Mailing-Liste
Elektronische Publikation
Kontextbezogenes System
Konfiguration <Informatik>
Mereologie
Strategisches Spiel
Gamecontroller
Computerunterstützte Übersetzung
Einfach zusammenhängender Raum
Internetworking
App <Programm>
Router
Elektronische Publikation
Code
Internetworking
Web Services
Datennetz
Datenstruktur
Verzeichnisdienst
Gerade
Fehlermeldung
Router
App <Programm>
Server
Bit
Konfiguration <Informatik>
Datennetz
Datenhaltung
Browser
Stellenring
Routing
Dienst <Informatik>
Sichtenkonzept
Code
Open Source
Web Services
Server
URL
Einfach zusammenhängender Raum
Soundverarbeitung
Internetworking
App <Programm>
Videospiel
Server
Momentenproblem
Datennetz
Browser
Wurm <Informatik>
Einfach zusammenhängender Raum
Dienst <Informatik>
Information
Internetworking
Mapping <Computergraphik>
Open Source
Datensatz
Web Services
Datennetz
Datentyp
Web-Designer
Punkt
Information
Einfach zusammenhängender Raum
Stellenring
Dongle
Datennetz
Linienelement
Formale Sprache
Kartesische Koordinaten
Intelligentes Netz
Endogene Variable
Internetworking
Datenfeld
Web Services
Server
Thread
Wort <Informatik>
Response-Zeit
URL
Gerade
URL
Hash-Algorithmus
Graph
Ruhmasse
Zahlenbereich
Benutzerbeteiligung
Multiplikation
Web Services
F-Test
Prozess <Informatik>
Microsoft dot net
Thread
Quadratzahl
Zentraleinheit
Touchscreen
Automatische Indexierung
Stellenring
Einfügungsdämpfung
Browser
Datenhaltung
Flächentheorie
Browser
Stellenring
Dienst <Informatik>
Synchronisierung
Datenhaltung
Open Source
Softwaretest
Web Services
Automatische Indexierung
Server
Einfügungsdämpfung
Benutzerführung
Objekt <Kategorie>
Faserbündel
App <Programm>
Web Services
Ganze Funktion
Volumenvisualisierung
Server
Zahlenbereich
Dienst <Informatik>
Patch <Software>
Arithmetischer Ausdruck
Endogene Variable
Einfach zusammenhängender Raum
Kraftfahrzeugmechatroniker
Domain <Netzwerk>
Facebook
Hash-Algorithmus
Browser
Gruppenoperation
Einfache Genauigkeit
Biprodukt
Service provider
Gerichteter Graph
Open Source
Web Services
Partikelsystem
Gerade
Message-Passing
Demo <Programm>
Softwaretest
Komponententest
Browser
Mathematisierung
Zahlenbereich
Dienst <Informatik>
PROM
Web Services
Softwaretest
Bereichsschätzung
Fächer <Mathematik>
Einheit <Mathematik>
Projektive Ebene
Normalspannung
Innerer Punkt
Caching
Nichtlinearer Operator
App <Programm>
Punkt
Browser
Browser
Automatische Handlungsplanung
Familie <Mathematik>
Vorzeichen <Mathematik>
Kartesische Koordinaten
Dienst <Informatik>
Web log
Open Source
Web Services
Automatische Indexierung
Caching
Mereologie
Kategorie <Mathematik>
Versionsverwaltung
Implementierung
Open Source
Vervollständigung <Mathematik>
Web Services
Schaltnetz
Benutzerführung
Quick-Sort
Web Services
Mapping <Computergraphik>
Rechenschieber
Open Source
Web Site
Web Services
Browser
Information
Web Services
Videokonferenz
Open Source
Euler-Winkel
ATM
Rechenschieber
Twitter <Softwareplattform>
Ereignishorizont
Menge

Metadaten

Formale Metadaten

Titel Using Service Workers in Ember
Serientitel Ember Conf 2016
Autor Kleinschmidt, John
Lizenz CC-Namensnennung - Weitergabe unter gleichen Bedingungen 3.0 Unported:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen und nicht-kommerziellen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen und das Werk bzw. diesen Inhalt auch in veränderter Form nur unter den Bedingungen dieser Lizenz weitergeben.
DOI 10.5446/34719
Herausgeber Confreaks, LLC
Erscheinungsjahr 2016
Sprache Englisch

Inhaltliche Metadaten

Fachgebiet Informatik
Abstract Service Workers are now available in browsers but why should we as Ember developers care about them? In this talk we will examine some of the common use cases for Service Workers and patterns for implementing them in your Ember applications.

Ähnliche Filme

Loading...
Feedback