The best way, IMO, is to code to a meta-API that can, transparently, connect to multiple other APIs, which makes it easy to switch brokers or data streams.
Medved Trader, for example, is a PC application that connects to lots of brokers and data streams. It also has an internal simple Websocket...