Williams joined the Hammers from Yeovil back in December for a fee of £250,000 and was scouted by Town during his time at Huish Park. However, his chances have been restricted at the Hammers and he has only made 11 senior appearances in claret and blue.
His only appearance for the Premiership club this season came in the 4-2 Carling Cup victory over Sheffield Wednesday.
The player who Royle has been chasing for some time made his international bow in August this year against Slovenia. He began his career at Hereford, before joining the successful Yeovil side that won promotion in 2002/2003.
Royle is a keen admirer of the player, "Gavin is an excellent midfielder, who has not figured much in the West Ham team this season. He is a plyer who we have been after for a while."
Dean Bowditch has previously been strongly linked with a move to Upton Park in the January transfer window but it is understood that this deal has no bearing on Bowditch's future. At the weekend the tabloids were reporting that they were no longer interested in the Town youngster.
25 year old Williams will join up with the squad for training on Wednesday but is then likely to be away with the Welsh National Sqaud for their match in Cyprus. Lewis Price will be expected to join him in Toshack's squad.
The news of William's imminent arrival comes shortly after the signing of another midfielder, Norweigan Vermund Brekke-Skard and the return to fitness of Ian Westlake and Kevin Horlock.
Skard, however, who joined Town for training on Tuesday, is yet to recieve clearance to play for the club. Under FA laws this is unlikely to happen until the January transfer window but Royle is hopeful it might be sooner.