code: func newSocket(s *Server) *Socket {
  	a := &Socket{
  		writeChan: make(chan string, global.WriteChanSize),
  		readChan:  make(chan string, global.ReadChanSize),
  	}
  
  	// Set the closer function.
  	a.closer = closer.New(func() {
  		// Remove the ajax socket from the map.
  		if len(a.uid) > 0 {
  			func() {
  				s.socketsMutex.Lock()
  				defer s.socketsMutex.Unlock()
  
  				delete(s.sockets, a.uid)
  			}()
  		}
  	})
  
  	return a
  }
docs: // Create a new ajax socket.