The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
ryanking8215

go.net.websocket的设计问题

  •  
  •   ryanking8215 ·
    ryanking8215 · Nov 1, 2013 · 1941 views
    This topic created in 4596 days ago, the information mentioned may be changed or developed.
    websocket设计用了type Handle func(*conn),即一个函数回调来处理websocket的连接,conn即websocket.conn,是type struct。函数回调的参数即指向了这个conn的一个指针。

    那如果我需要自己的MyWebscoketConn呢?这个要怎么破呢?


    反观像net.Dial和net.TcpListener,处理的都是net.conn,是一个type interface。有TcpConn实现了该interface,如果要设计自己的MyTcpConn,只要在MyTcpConn里mixin TcpConn就行了。
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1724 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 16:28 · PVG 00:28 · LAX 09:28 · JFK 12:28
    ♥ Do have faith in what you're doing.