It's 2013
Let's make a new social network!
Ideas for a lightweight, scalable and modern decentralized social networking server
Florian Hülsmann / cbix.de
No, wait..! A whole new social network!?
Use existing ones, speak their language (protocol) and keep all your virtual friends!
The problem with current implementations:
- slow
- not using full potential of current web standards
- most of them are just Twitter clones
- too static (chronological stream, full of uninteresting things)
- poor cross-host full text search support
Choose a protocol:
- OStatus
- FOAF
- tent
- friendica
- OpenSocial
- Kune / Wave
- DSNP
- OSMP
- Socknet
- Ampify
- libertree
- Kopal
- Zot
- SMTP
- XMPP
Client side (web browser)
- Cache posts/contacts/comments/... using localstorage
- Live updates through websockets
- Offline mode
- Client side plugins (custom post types, games)
- Mobile friendly (responsive)
Server side
- Lightweight
- Scalable (e.g. allow running multiple instances for faster search requests)
- Portable, few dependencies
- Websocket support
Go
A compiled programming language for scalable, fast server applications.
Supports concurrency:
func (p *Post) Distribute() {
for _, h := range p.ReceiveHosts {
go h.QueuePostNotification(p)
}
}
goroutines
communicate through channels.
func PostsListener(c chan *Post) {
for p := range <-c {
go db.StorePost(p)
go hub.PostNotify(p)
}
}
func main() {
postChan := make(chan *Post)
protoHandler := proto.NewHandler()
protoHandler.SetPostChan(postChan)
go PostsListener(postChan)
// ...
}
Websockets
func (hub *WebsocketHub) PostNotify(p *Post) {
for _, client := range hub.ConnectedClients {
client.MsgQueue <- p
}
}
Performance optimized full text / #hashtag search
- Client starts separate websocket connection for getting realtime search results
- sub/unsub for hashtags
- Optional open or authorized search API for other servers to use
- Order by relevance, search by subscribed hashtags first etc.
- Recursively run goroutines for searching messages/posts/profiles and spawning search on other servers
Go packages to be used
crypto for encrypted server to server communication
net/http as protocol base
encoding/json for client API
html/template for frontend templates
image for creating thumbnails etc.
Further ideas
- ownCloud lite with integrated collaboration and social networking functionality
- separate backend and frontend servers (the tent approach)
- even more advanced search engines and compromises between search result quality and efficiency (memory/cpu time)
- ...your ideas?
/
#