View Javadoc

1   //
2   //  ========================================================================
3   //  Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
4   //  ------------------------------------------------------------------------
5   //  All rights reserved. This program and the accompanying materials
6   //  are made available under the terms of the Eclipse Public License v1.0
7   //  and Apache License v2.0 which accompanies this distribution.
8   //
9   //      The Eclipse Public License is available at
10  //      http://www.eclipse.org/legal/epl-v10.html
11  //
12  //      The Apache License v2.0 is available at
13  //      http://www.opensource.org/licenses/apache2.0.php
14  //
15  //  You may elect to redistribute this code under either of these licenses.
16  //  ========================================================================
17  //
18  
19  package org.eclipse.jetty.websocket.common.events;
20  
21  import java.io.IOException;
22  import java.io.InputStream;
23  import java.io.Reader;
24  import java.nio.ByteBuffer;
25  
26  import org.eclipse.jetty.websocket.api.WebSocketPolicy;
27  import org.eclipse.jetty.websocket.api.extensions.Frame;
28  import org.eclipse.jetty.websocket.api.extensions.IncomingFrames;
29  import org.eclipse.jetty.websocket.common.CloseInfo;
30  import org.eclipse.jetty.websocket.common.WebSocketSession;
31  
32  public interface EventDriver extends IncomingFrames
33  {
34      public WebSocketPolicy getPolicy();
35  
36      public WebSocketSession getSession();
37  
38      public void onBinaryFrame(ByteBuffer buffer, boolean fin) throws IOException;
39  
40      public void onBinaryMessage(byte[] data);
41  
42      public void onClose(CloseInfo close);
43  
44      public void onConnect();
45  
46      public void onContinuationFrame(ByteBuffer buffer, boolean fin) throws IOException;
47  
48      public void onError(Throwable t);
49  
50      public void onFrame(Frame frame);
51  
52      public void onInputStream(InputStream stream);
53  
54      public void onPing(ByteBuffer buffer);
55      
56      public void onPong(ByteBuffer buffer);
57  
58      public void onReader(Reader reader);
59  
60      public void onTextFrame(ByteBuffer buffer, boolean fin) throws IOException;
61  
62      public void onTextMessage(String message);
63  
64      public void openSession(WebSocketSession session);
65  }