You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2016/09/10 14:41:39 UTC
[31/37] cxf git commit: CXF-5855: Introduce support for Server Sent
Events. Initial implementation based on Atmosphere
http://git-wip-us.apache.org/repos/asf/cxf/blob/9a5a54ac/distribution/src/main/release/samples/jax_rs/sse_tomcat/README.txt
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_tomcat/README.txt b/distribution/src/main/release/samples/jax_rs/sse_tomcat/README.txt
new file mode 100644
index 0000000..2e4a2e3
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_tomcat/README.txt
@@ -0,0 +1,35 @@
+JAX-RS SSE Demo
+=================
+
+This is a SSE version of JAX-RS Basic Demo.
+
+A SSE endpoint service is provided on URL http://localhost:8686/rest/api/stats/sse/{id}
+where {id} is any integer value, f.e.:
+
+ http://localhost:8686/rest/api/stats/sse/1
+
+This sample includes a simple web UI using Highcharts JavaScript library to show off
+randomly generated statistics about particular server, pushed to the client using
+SSE JAX-RS endpoint. The UI is available at
+
+ http://localhost:8686/static/index.html
+
+Under the hood, embedded Tomcat 8 container is being used.
+
+Building and running the demo using maven
+---------------------------------------
+
+From the base directory of this sample (i.e., where this README file is
+located), the maven pom.xml file can be used to build and run the demo.
+
+Using either UNIX or Windows:
+
+ mvn install
+ mvn -Pserver
+
+To remove the target dir, run mvn clean".
+
+Connecting to the SSE stream
+---------------------------------------
+
+Open a web browser at: http://localhost:8686/static/index.html
http://git-wip-us.apache.org/repos/asf/cxf/blob/9a5a54ac/distribution/src/main/release/samples/jax_rs/sse_tomcat/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_tomcat/pom.xml b/distribution/src/main/release/samples/jax_rs/sse_tomcat/pom.xml
new file mode 100644
index 0000000..06d905b
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_tomcat/pom.xml
@@ -0,0 +1,140 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <name>JAX-RS SSE Demo (Tomcat 8)</name>
+ <description>JAX-RS SSE Demo (Tomcat 8)</description>
+ <artifactId>jax_rs_sse_tomcat</artifactId>
+
+ <parent>
+ <groupId>org.apache.cxf.samples</groupId>
+ <artifactId>cxf-samples</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <cxf.tomcat.version>8.0.32</cxf.tomcat.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-sse</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.jaxrs</groupId>
+ <artifactId>jackson-jaxrs-json-provider</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-core</artifactId>
+ <version>${cxf.tomcat.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-logging-juli</artifactId>
+ <version>${cxf.tomcat.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-jasper</artifactId>
+ <version>${cxf.tomcat.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-jasper</artifactId>
+ <version>${cxf.tomcat.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-jasper-el</artifactId>
+ <version>${cxf.tomcat.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-jsp-api</artifactId>
+ <version>${cxf.tomcat.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-websocket</artifactId>
+ <version>${cxf.tomcat.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.atmosphere</groupId>
+ <artifactId>atmosphere-runtime</artifactId>
+ <version>2.4.3</version>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>server</id>
+ <build>
+ <defaultGoal>test</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>test</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <configuration>
+ <mainClass>demo.jaxrs.sse.StatsServer</mainClass>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/cxf/blob/9a5a54ac/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/java/demo/jaxrs/sse/Stats.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/java/demo/jaxrs/sse/Stats.java b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/java/demo/jaxrs/sse/Stats.java
new file mode 100644
index 0000000..874047c
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/java/demo/jaxrs/sse/Stats.java
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.jaxrs.sse;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonInclude(value = Include.NON_NULL)
+public class Stats implements Serializable {
+ private static final long serialVersionUID = -6705829915457870975L;
+
+ private long timestamp;
+ private int load;
+
+ public Stats() {
+ }
+
+ public Stats(long timestamp, int load) {
+ this.timestamp = timestamp;
+ this.load = load;
+ }
+
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(long timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public int getLoad() {
+ return load;
+ }
+
+ public void setLoad(int load) {
+ this.load = load;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/9a5a54ac/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java
new file mode 100644
index 0000000..b8f8608
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/java/demo/jaxrs/sse/StatsRestServiceImpl.java
@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.jaxrs.sse;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.Random;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.sse.OutboundSseEvent;
+import javax.ws.rs.sse.SseContext;
+import javax.ws.rs.sse.SseEventOutput;
+
+@Path("/stats")
+public class StatsRestServiceImpl {
+ private static final Random RANDOM = new Random();
+
+ private static OutboundSseEvent createStatsEvent(final OutboundSseEvent.Builder builder, final int eventId) {
+ return builder
+ .id("" + eventId)
+ .data(Stats.class, new Stats(new Date().getTime(), RANDOM.nextInt(100)))
+ .mediaType(MediaType.APPLICATION_JSON_TYPE)
+ .build();
+ }
+
+ @GET
+ @Path("sse/{id}")
+ @Produces("text/event-stream")
+ public SseEventOutput stats(@Context SseContext sseContext, @PathParam("id") final String id) {
+ final SseEventOutput output = sseContext.newOutput();
+
+ new Thread() {
+ public void run() {
+ try {
+ output.write(createStatsEvent(sseContext.newEvent().name("stats"), 1));
+ Thread.sleep(1000);
+ output.write(createStatsEvent(sseContext.newEvent().name("stats"), 2));
+ Thread.sleep(1000);
+ output.write(createStatsEvent(sseContext.newEvent().name("stats"), 3));
+ Thread.sleep(1000);
+ output.write(createStatsEvent(sseContext.newEvent().name("stats"), 4));
+ Thread.sleep(1000);
+ output.write(createStatsEvent(sseContext.newEvent().name("stats"), 5));
+ Thread.sleep(1000);
+ output.write(createStatsEvent(sseContext.newEvent().name("stats"), 6));
+ Thread.sleep(1000);
+ output.write(createStatsEvent(sseContext.newEvent().name("stats"), 7));
+ Thread.sleep(1000);
+ output.write(createStatsEvent(sseContext.newEvent().name("stats"), 8));
+ output.close();
+ } catch (final InterruptedException | IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }.start();
+
+ return output;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/9a5a54ac/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/java/demo/jaxrs/sse/StatsServer.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/java/demo/jaxrs/sse/StatsServer.java b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/java/demo/jaxrs/sse/StatsServer.java
new file mode 100644
index 0000000..8a8831b
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/java/demo/jaxrs/sse/StatsServer.java
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.jaxrs.sse;
+
+import java.io.File;
+
+import org.apache.catalina.Context;
+import org.apache.catalina.WebResourceRoot;
+import org.apache.catalina.Wrapper;
+import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.servlets.DefaultServlet;
+import org.apache.catalina.startup.Tomcat;
+import org.apache.catalina.webresources.DirResourceSet;
+import org.apache.catalina.webresources.StandardRoot;
+import org.apache.cxf.transport.servlet.CXFServlet;
+import org.apache.cxf.transport.sse.SseHttpTransportFactory;
+import org.springframework.web.context.ContextLoaderListener;
+
+public final class StatsServer {
+ private StatsServer() {
+ }
+
+ public static void main(final String[] args) throws Exception {
+ // Register and map the dispatcher servlet
+ final File base = new File(System.getProperty("java.io.tmpdir"));
+
+ final Tomcat server = new Tomcat();
+ server.setPort(8686);
+ server.setBaseDir(base.getAbsolutePath());
+
+ final StandardContext context = (StandardContext)server.addWebapp("/", base.getAbsolutePath());
+ context.setConfigFile(StatsServer.class.getResource("/META-INF/context.xml"));
+ context.addApplicationListener(ContextLoaderListener.class.getName());
+ context.setAddWebinfClassesResources(true);
+ context.setResources(resourcesFrom(context, "target/classes"));
+
+ final Wrapper cxfServlet = Tomcat.addServlet(context, "cxfServlet", new CXFServlet());
+ cxfServlet.addInitParameter(CXFServlet.TRANSPORT_ID, SseHttpTransportFactory.TRANSPORT_ID);
+ context.addServletMapping("/rest/*", "cxfServlet");
+
+ final Context staticContext = server.addWebapp("/static", base.getAbsolutePath());
+ Tomcat.addServlet(staticContext, "cxfStaticServlet", new DefaultServlet());
+ staticContext.addServletMapping("/static/*", "cxfStaticServlet");
+ staticContext.setResources(resourcesFrom(staticContext, "target/classes/web-ui"));
+ staticContext.setParentClassLoader(Thread.currentThread().getContextClassLoader());
+
+ server.start();
+ server.getServer().await();
+ }
+
+ private static WebResourceRoot resourcesFrom(final Context context, final String path) {
+ final File additionResources = new File(path);
+ final WebResourceRoot resources = new StandardRoot(context);
+ resources.addPreResources(new DirResourceSet(resources, "/", additionResources.getAbsolutePath(), "/"));
+ return resources;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/cxf/blob/9a5a54ac/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/META-INF/cxf/org.apache.cxf.Logger
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/META-INF/cxf/org.apache.cxf.Logger b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/META-INF/cxf/org.apache.cxf.Logger
new file mode 100644
index 0000000..27dd788
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/META-INF/cxf/org.apache.cxf.Logger
@@ -0,0 +1 @@
+org.apache.cxf.common.logging.Slf4jLogger
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf/blob/9a5a54ac/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/WEB-INF/applicationContext.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/WEB-INF/applicationContext.xml b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/WEB-INF/applicationContext.xml
new file mode 100644
index 0000000..d4d4584
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/WEB-INF/applicationContext.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xmlns:jaxrsclient="http://cxf.apache.org/jaxrs-client"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://cxf.apache.org/jaxrs
+ http://cxf.apache.org/schemas/jaxrs.xsd">
+
+ <jaxrs:server id="statsServer" address="/api" transportId="http://cxf.apache.org/transports/http/sse">
+ <jaxrs:serviceBeans>
+ <ref bean="statsRestService"/>
+ </jaxrs:serviceBeans>
+ <jaxrs:providers>
+ <ref bean="jacksonJsonProvider"/>
+ </jaxrs:providers>
+ </jaxrs:server>
+
+ <bean id="statsRestService" class="demo.jaxrs.sse.StatsRestServiceImpl"/>
+ <bean id="jacksonJsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"/>
+</beans>
+
http://git-wip-us.apache.org/repos/asf/cxf/blob/9a5a54ac/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/log.properties
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/log.properties b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/log.properties
new file mode 100644
index 0000000..d7336e2
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/log.properties
@@ -0,0 +1,2 @@
+handlers=java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level=FINEST
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf/blob/9a5a54ac/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/logback.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/logback.xml b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/logback.xml
new file mode 100644
index 0000000..1052186
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/logback.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration scan="true" scanPeriod="5 seconds">
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>[%level] %d{yyyy-MM-dd HH:mm:ss.SSS} %logger{36} - [%X] %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <root level="DEBUG">
+ <appender-ref ref="STDOUT" />
+ </root>
+
+ <logger category="org.jboss.weld">
+ <level name="DEBUG"/>
+ </logger>
+</configuration>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf/blob/9a5a54ac/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/web-ui/index.html
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/web-ui/index.html b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/web-ui/index.html
new file mode 100644
index 0000000..2aaed6e
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/sse_tomcat/src/main/resources/web-ui/index.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>SSE: Apache CXF example</title>
+ <script src="javascripts/jquery-1.9.0.min.js" type="text/javascript"></script>
+ <script src="javascripts/highcharts.js" type="text/javascript"></script>
+ </head>
+
+ <body>
+ <div id="content">
+ <div id="chart">
+ </div>
+ </div>
+ </body>
+</html>
+
+<script type="text/javascript">
+ var chart = new Highcharts.Chart({
+ chart: {
+ renderTo: 'chart',
+ defaultSeriesType: 'spline'
+ },
+ xAxis: {
+ type: 'datetime'
+ },
+ series: [{
+ name: "CPU",
+ data: []
+ }
+ ]
+ });
+
+ if( !!window.EventSource ) {
+ var event = new EventSource("http://localhost:8686/rest/api/stats/sse/1");
+
+ event.addEventListener('message', function( event ) {
+ var datapoint = jQuery.parseJSON( event.data );
+
+ chart.series[ 0 ].addPoint({
+ x: datapoint.timestamp,
+ y: datapoint.load
+ }, true, chart.series[ 0 ].data.length >= 50 );
+ } );
+
+ $('#content').bind('unload',function() {
+ event.close();
+ });
+ }
+</script>
\ No newline at end of file