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

go.net.websocket的设计问题

  •  
  •   ryanking8215 ·
    ryanking8215 · Nov 1, 2013 · 1897 views
    This topic created in 4574 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   ·   1279 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:43 · PVG 07:43 · LAX 16:43 · JFK 19:43
    ♥ Do have faith in what you're doing.